import { View, Text } from '@tarojs/components'; import { Component, ReactNode } from 'react'; import Taro from '@tarojs/taro'; import type CustomTabBar from '../../custom-tab-bar'; import './index.scss'; class Index extends Component { state = { msg: 'Hello World!', }; // 以下是TabBar相关 pageCtx = Taro.getCurrentInstance().page; componentDidShow() { const tabbar = Taro.getTabBar(this.pageCtx); tabbar?.setSelected(0); } // 以上是TabBar相关 render(): ReactNode { return ( {this.state.msg} ); } } export default Index;