arco-design / arco-design-vue

A Vue.js 3 UI Library based on Arco Design
https://arco.design/vue
MIT License
2.74k stars 536 forks source link

在vite3 vue3 unocss中因为[hidden]样式导致md:block属性失效 #1527

Open zxbeltm opened 2 years ago

zxbeltm commented 2 years ago

Basic Info

Extra info

https://github.com/arco-design/arco-design-vue/blob/main/packages/web-vue/components/style/normalize.less

/**
 * Add the correct display in IE 10.
 */

[hidden] {
  display: none;
}

What is expected?

使用arco.design组件会生成样式:

[hidden] {
    display: none !important;
}

这样导致了unocss的 md:block hidden 样式失效:

@media (min-width: 768px)
.md\:block, [md\:block=""] {
    display: block;
}
[hidden=""] {
    display: none;
}

Steps to reproduce

在项目vite3 vue3 unocss arco.design中: // main.css

html {
  font-size: 4px;
}

// App.vue

<div w-380 md:block px-20 py-35 hidden>
        达到最小宽度后会隐藏
</div>
    <a-badge :count="9" dot :dotStyle="{ width: '10px', height: '10px' }">
      <a-avatar shape="square" />
    </a-badge>
hehehai commented 2 years ago

😅 纳闷这个 important 是怎么出现的

[hidden] {
    display: none !important;
}