uni-app 组件告警等于炸弹

uni-app 组件告警等于炸弹

开发环境 版本号 项目创建方式
Mac macOs Monterey 12.0.1 HBuilderX
### 操作步骤:
单页面 ,使用了v-if 动态加载数据显示列表 也会报错

### 预期结果:
正常显示列表

### 实际结果:
没有显示

### bug描述:
[pages/login/loginByAccount] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./uni_modules/uni-load-more/components/uni-load-more/uni-load-more.wxss:198:35)
上面是uniapp组件报的警告  

更多关于uni-app 组件告警等于炸弹的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于uni-app 组件告警等于炸弹的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这个警告是微信小程序平台对组件样式的限制导致的,不是真正的“炸弹”,但需要正确处理。

问题根源: 微信小程序自定义组件的wxss文件中,不允许使用标签选择器、ID选择器和属性选择器。uni-load-more组件在第198行使用了这些受限的选择器。

解决方案:

  1. 临时方案(推荐):manifest.json 中添加以下配置:
    {
      "mp-weixin": {
        "styleIsolation": "apply-shared"
      }
    }
回到顶部