前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Taro 函数式组件配置页面参数

Taro 函数式组件配置页面参数

原创
作者头像
小鑫
发布2022-05-11 16:36:09
6550
发布2022-05-11 16:36:09
举报
文章被收录于专栏:小鑫の随笔小鑫の随笔

原来类组件的写法:

代码语言:javascript
复制
export default class Index extends Component {
  config = {
    navigationBarTitleText: '首页',
    navigationBarBackgroundColor: '#ffffff',
    backgroundColor: '#eeeeee',
    navigationBarTextStyle: 'black',
    backgroundTextStyle: 'light'
  }

  render () {
    return (
      <View className='index'>
      </View>
    )
  }
}

如果是函数式组件需要换种写法:

代码语言:javascript
复制
function Index() {
  return (
    <View className='index'>
      <Text>1</Text>
    </View>
  )
}

Index.config = {
  navigationBarTitleText: '首页',
  navigationBarBackgroundColor: '#ffffff',
  backgroundColor: '#eeeeee',
  navigationBarTextStyle: 'black',
  backgroundTextStyle: 'light'
}

export default Index

首发自:Taro 函数式组件配置页面参数 - 小鑫の随笔

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档