taro icon indicating copy to clipboard operation
taro copied to clipboard

样式载入顺序问题

Open frankcou opened this issue 1 year ago • 1 comments

相关平台

H5

浏览器版本: Microsoft Edge 版本 116.0.1938.76 (正式版本) (64 位) 使用框架: Vue 3

复现步骤

<script lang="tsx">
import { computed, useCssModule } from "vue";
import useRender from "@/utils/hooks/render";
import { Button } from "@tarojs/components";
// import "./index.scss";

export default {
  name: "my-btn",
  setup(props, ctx) {
    const styles = useCssModule();
    return () => <Button>1111</Button>;
  },
};
</script>

<style lang="scss" module>
taro-button-core +  taro-button-core {
  margin-top: 0;
}
</style>

上面的写法中,组件样式的权重没有 Button 自带样式权重高。

但我尝试使用import "./index.scss";的时候,组件样式的权重比 Button 自带样式权重高。

期望结果

组件样式的权重比 Button 自带样式权重高。 另外,希望tarojs的组件不要随意增加组件与组件之间的样式。

实际结果

希望各种写法的编译结果与顺序都一致

环境信息

👽 Taro v3.6.11

undefined

  Taro CLI 3.6.11 environment info:
    System:
      OS: Windows 10 10.0.19044
    Binaries:
      Node: 20.2.0 - D:\SofeWare\node\node.EXE
      npm: 8.1.0 - D:\SofeWare\node\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.11 => 3.6.11 
      @tarojs/components: 3.6.11 => 3.6.11 
      @tarojs/helper: 3.6.11 => 3.6.11 
      @tarojs/plugin-framework-vue3: 3.6.11 => 3.6.11  
      @tarojs/plugin-html: ^3.6.12 => 3.6.12 
      @tarojs/plugin-platform-alipay: 3.6.11 => 3.6.11 
      @tarojs/plugin-platform-h5: 3.6.11 => 3.6.11     
      @tarojs/plugin-platform-jd: 3.6.11 => 3.6.11     
      @tarojs/plugin-platform-qq: 3.6.11 => 3.6.11     
      @tarojs/plugin-platform-swan: 3.6.11 => 3.6.11   
      @tarojs/plugin-platform-tt: 3.6.11 => 3.6.11     
      @tarojs/plugin-platform-weapp: 3.6.11 => 3.6.11  
      @tarojs/plugin-vue-devtools: 3.6.11 => 3.6.11
      @tarojs/runtime: 3.6.11 => 3.6.11
      @tarojs/shared: 3.6.11 => 3.6.11
      @tarojs/taro: 3.6.11 => 3.6.11
      @tarojs/taro-loader: 3.6.11 => 3.6.11
      @tarojs/webpack5-runner: 3.6.11 => 3.6.11
      babel-preset-taro: 3.6.11 => 3.6.11
      eslint-config-taro: 3.6.11 => 3.6.11

frankcou avatar Sep 12 '23 08:09 frankcou