使用hooks 配置 index.config.js 的 navigationBarTitleText 在微信小程序会失效
-
如题,请问大佬们怎么解决
-
可以直接给函数组件添加config属性:
export default function Index(){ return <Text>你好世界</Text> } Index.config = { navigationBarTitleText:"首页" }
如果用Typescript,添加as Config就可以实现类型提示:
Index.config = { navigationBarTitleText:"首页" } as Config
另写配置文件的方式我没用过,但以上肯定是可用的。
更新:Taro 3.0 应该不再支持这种写法了