如果配置自定义组件(页面)的背景颜色?

发布于 8 年前作者 longyong3420 次浏览最后编辑 8 年前来自 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 回复
chao68
chao681 楼5 年前
Component({
  options: {
    addGlobalClass: true, // 基础库2.2.3开始支持
  },
})
// 样式写在page页面wxss或者app.wxss中