import { Component } from 'react' import Taro from '@tarojs/taro' import { CoverView, CoverImage } from '@tarojs/components' import './index.less'; export default class Index extends Component { state = { selected: 0, color: '#000000', selectedColor: '#DC143C', list: [ { pagePath: '/pages/index/index', selectedIconPath: '../images/tabbar_home_on.png', iconPath: '../images/tabbar_home.png', text: '首页' }, { pagePath: '/pages/newIndex/newIndex', selectedIconPath: '../images/tabbar_cate_on.png', iconPath: '../images/tabbar_cate.png', text: '分类' }, ] } switchTab(index, url) { this.setSelected(index) Taro.switchTab({ url }) } setSelected (idx: number) { this.setState({ selected: idx }) } render() { const { list, selected, color, selectedColor } = this.state return ( {list.map((item, index) => { return ( {item.text} ) })} ) } }