Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小程序 page config 中配置 backgroundColor 无效 #1181

Closed
zoux opened this issue Nov 19, 2018 · 8 comments
Closed

小程序 page config 中配置 backgroundColor 无效 #1181

zoux opened this issue Nov 19, 2018 · 8 comments

Comments

@zoux
Copy link
Contributor

zoux commented Nov 19, 2018

设置 navigationBarTitleText 是有效的,而在 config 对象里设置 backgroundColor 并赋值如'#f7f7f7',页面中并未生效。

目前暂时通过 min-height: 100vh + background 的方式实现的。

@taro-bot
Copy link

taro-bot bot commented Nov 19, 2018

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam
Copy link
Member

代码贴一下

@zoux
Copy link
Contributor Author

zoux commented Nov 20, 2018

挂载在 app.tsx 的 page 属性上的页面

class Index extends Component<{}, State> {
config: Config = {
navigationBarTitleText: '余额付款码',
backgroundColor: '#000000'
}

state = {
}

render () {
return (
...
)
}
}

navigationBarTitleText 可以正常配置显示,但 backgroundColor 不生效。

@jeff-fe
Copy link

jeff-fe commented Nov 20, 2018

@zoux config中的backgroundColor属性是设置窗口的背景色,这种在下拉刷新时能看到!想要设置page的背景色直接在css文件,加如下代码

page {
  background-color: #ccc;
}

@duanzheng
Copy link

这个issue怎么关掉了?这不算解决了问题吧,用css的话我还要解决如何把容器撑开的问题

@jethroHuang
Copy link

这个issue怎么关掉了?这不算解决了问题吧,用css的话我还要解决如何把容器撑开的问题

不用考虑撑开的问题,直接写page的就行了

@shzjj82
Copy link

shzjj82 commented Dec 13, 2018

那如果在react native端 page是不支持的啊

@edwardfxiao
Copy link

edwardfxiao commented Sep 20, 2022

@jeff-fe

page {
  /*background-color: #ccc;*/ // 生效
  background-color: var(--myBackgroundColor); // 不生效
}
.myTextClass {
  background-color: var(--myBackgroundColor); // 生效
}

想问一下为什么var的方法就单独page不可行?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants