import Taro , { Component , Config } from "@tarojs/taro" ; import { Provider } from "@tarojs/mobx" ; import "./app.scss" ; import counterStore from "./store/counter" ; import rankStore from "./store/dailyrank" ; import Day from "./pages/today" ; const store = { counterStore , rankStore } ; class App extends Component { /**
     * 指定config的类型声明为: Taro.Config
     *
     * 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型
     * 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string
     * 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型
     */ config : Config = { pages : [ "pages/today/index" , "pages/leetcode/index" , "pages/index/index" , "pages/rank/index" , "pages/detail/index" ] , window : { backgroundTextStyle : "light" , navigationBarBackgroundColor : "#fff" , navigationBarTitleText : "WeChat" , navigationBarTextStyle : "black" } } ; componentDidMount ( ) { } componentDidShow ( ) { } componentDidHide ( ) { } componentDidCatchError ( ) { } render ( ) { return ( < Provider store = { store } > < Day /> < /Provider>); } } Taro . render ( < App />, document.getElementById("app"));