如果配置自定义组件(页面)的背景颜色?
发布于 7 年前 作者 longyong 3271 次浏览 来自 官方Issues

如果要定义一个自定义组件(页面)的背景颜色,我尝试这样写:

page {
  background-color: #fff;
}

事实上这样会报错:

Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./pages/support/support.wxss:2:1)

那么对自定义组件(页面)的背景颜色进行配置,WXSS要怎么写才是规范的?谢谢

1 回复
Component({
  options: {
    addGlobalClass: true, // 基础库2.2.3开始支持
  },
})
// 样式写在page页面wxss或者app.wxss中
回到顶部