直接使用标签选择器,并且设置的是继承属性。组件内的样式,会影响组件外的样式。
发布于 5 年前 作者 jun01 13044 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

在自定义组件里使用标签选择器,并设置继承属性,会影响页面中的样式。

child.wxss:

view{

width:200px;

height:200px;

background: blue;

color:blue;

font-size:30px;

}

index.wxml

<view class=“box”>父组件内容</view>

index.wxss

.box{

width:50px;

height:50px;

background: orange;

}

app.json (只是引入,还没有在页面中使用子组件)

“usingComponents”: {

“child”: “./components/child”

}

回到顶部