We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
state
问题描述 特定情况下(见下图), 微信页面报警告:
import Taro, { Component } from '@tarojs/taro' import { View } from '@tarojs/components' export default class TestPage extends Component { config = { navigationBarTitleText: 'echarts-for-weixin 示例项目', } static defaultProps = { onGetStyles: () => { return {} }, } render () { return ( <View className='echarts' style={{...this.props.onGetStyles()}} > </View> ) } }
系统信息
补充信息 若采用这种写法则不会报警告:
import Taro, { Component } from '@tarojs/taro' import { View } from '@tarojs/components' export default class TestPage extends Component { config = { navigationBarTitleText: 'echarts-for-weixin 示例项目', } render () { const { onGetStyles = () => { return {} }, } = this.state return ( <View className='echarts' style={onGetStyles()} > </View> ) } }
The text was updated successfully, but these errors were encountered:
欢迎提交 Issue~
如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏
如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。
Good luck and happy coding~
Sorry, something went wrong.
onGetStyles 是需要从外面传进来么,如果不需要就放到组件内部 如果需要传进来,暂时先在 render 里给 this.props.onGetStyles 执行的地方加一个容错吧 defaultProps 目前对函数处理有点问题
onGetStyles
render
this.props.onGetStyles
defaultProps
CC @Chen-jj
@luckyadam 谢谢 你们的回复很及时 hhhh
问题需要close么
Chen-jj
No branches or pull requests
问题描述
特定情况下(见下图), 微信页面报警告:
系统信息
补充信息
若采用这种写法则不会报警告:
The text was updated successfully, but these errors were encountered: