Skip to content

预设与 tailwindcss 冲突,没有设置途径 #6407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
jiangmaniu opened this issue Mar 29, 2023 · 6 comments
Closed
1 task done

预设与 tailwindcss 冲突,没有设置途径 #6407

jiangmaniu opened this issue Mar 29, 2023 · 6 comments
Labels

Comments

@jiangmaniu
Copy link

jiangmaniu commented Mar 29, 2023

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.0.0-alpha.3

Environment

根据 antd issues 可知 由于权重问题,导致样式会被 tailwindcss 预设给覆盖,根据官网可知,通过将 StyleProvider 组件的 hashPriority 属性设置为 "high",即可解决该问题,但我再使用时发现该组件库没有导出StyleProvider 组件,看了源码后发现是通过 inject/provide 实现的,并且hashPriority 属性是写死的,无法通过业务层设置。

如果

Reproduction link

http://baidu.com

希望能与antd一样导出一个StyleProvider组件供用户设置,也可以将设置参数集成到ConfigProvider组件中,或者以其他方式进行设置。

可有可能是我没有发现相关设置的途径,我已尽我所能去源码中寻找。如果确实如此,请您告诉我该怎么做

@github-actions github-actions bot changed the title 预设与 tailwindcss Presets with tailwindcss Mar 29, 2023
@jiangmaniu jiangmaniu changed the title Presets with tailwindcss 预设与 tailwindcss 冲突,没有设置途径 Mar 29, 2023
@CCherry07
Copy link
Member

CCherry07 commented Mar 30, 2023

@jiangmaniu 我感觉可以,将useStyleProvider引入,如果可以,我会去提一个pr

import { useStyleProvider } from 'ant-design-vue/es/_util/cssinjs';
useStyleProvider({
  hashPriority:"high",
});

@tangjinzhou
Copy link
Member

@jiangmaniu 我感觉可以,将useStyleProvider引入,如果可以,我会去提一个pr

import { useStyleProvider } from 'ant-design-vue/es/_util/cssinjs';
useStyleProvider({
  hashPriority:"high",
});

@CCherry07 包一个 StyleProvider 组件出来吧,用use 的有点问题(调用use的那个组件不会生效)

@selvinzr
Copy link

<template>
<style-provider hashPriority="high">
{node}
</style-provider>
</template>
<script setup lang="ts">
import { StyleProvider } from 'ant-design-vue/es/_util/cssinjs';
</script>

我在rc6中运行正常,并提供了其他的api

@selvinzr
Copy link

@jiangmaniu 我感觉可以,将useStyleProvider引入,如果可以,我会去提一个pr

import { useStyleProvider } from 'ant-design-vue/es/_util/cssinjs';
useStyleProvider({
  hashPriority:"high",
});

它在控制台报了一个错误
[Vue warn]: Invalid watch source: {hashPriority: 'high'} A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.

@gaokun
Copy link
Contributor

gaokun commented Feb 29, 2024

应该将StyleProvider用法, 添加到ant design vue的官方文档中

Copy link

github-actions bot commented Mar 1, 2025

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants