微信小程序和uni-app报错
Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/tabbar/index/index-list.wxss:122:38) at app-view.js:1885
- 错误原因是因为在子组件中不可以直接使用
text buton image
标签选择器 - 解决方法使用
class id
选择器
<view class="nothing-box">
<image src="../../../static/images/nothing.png" class="box-image"></image>
</view>
- 如果直接使用 下面的选择器 报错
.nothing-box image {
width: 50%
}
- 正确的写法
.nothing-box .box-image {
width: 50%
}