import { Component } from 'react' import Taro from '@tarojs/taro' import { CoverView, View } from '@tarojs/components' import './index.less' export default class Index extends Component { state = { selected: 0, color: '#999999', selectedColor: '#ffffff', backgroundColor: '#000000', fontSize: 22, list: [ { pagePath: '/pages/category/index', text: '้ฆ–้กต' }, { pagePath: '/pages/home/home', text: 'ๆˆ‘็š„' } ] } switchTab(index, url) { this.setSelected(index) Taro.switchTab({ url }) } setSelected (idx: number) { this.setState({ selected: idx }) } render() { const { list, selected, color, selectedColor, backgroundColor, fontSize } = this.state return ( {list.map((item, index) => { return ( {item.text} ) })} ) } }