[图片]是不是少写了这个?
自定义的tabBar在开发者工具显示,在真机调试时不显示,没有显示报错?自定义的tabBar,打算实现不同用户角色登录显示不同的底部tab。但是在开发者工具模拟器上显示的出来而真机调试的时候就没了。 [图片] [图片] 初步怀疑是不是基础库或者版本类型的问题,本人初学者有点不会了。 这是appjson中的tab [图片] 这是自定义的tab [图片][图片]
2021-08-12[图片]是没写这个属性么?
taro 自定义tabBar 开发工具显示正常,真机调试不显示?import React, { Component } from 'react' import { connect } from 'react-redux'; import { switchTab } from '@tarojs/taro' import { CoverView, CoverImage, Text , View} from '@tarojs/components' import './index.scss' interface CustomTabBarState { dispatch, common, } const NORMAL_COLOR = '#999999' const SELECTED_COLOR = '#FE7741' @connect(({ common }) => ({ common, })) export default class CustomTabBar extends Component<CustomTabBarState> { state = { current: 0, } changeTab = (item: any) => { const { dispatch } =this.props; switchTab({ url: item.pagePath }) dispatch({ type: 'common/updateState', payload: { selectedPath:item.pagePath }, }) } render() { const { common:{selectedPath, tabList }} = this.props; return ( <CoverView className='tab'> {tabList.map((item, index) => { return ( <CoverView className='tab-item' onClick={this.changeTab.bind(this, item, index)} data-path={item.pagePath} key={item.text} > {/* 请使用 base64 格式,否则会存在性能问题 */} <CoverImage className='tab-item-img' src={ selectedPath === item.pagePath ? item.selectedIconPath : item.iconPath } /> <View className='tab-item-text' style={{ color: selectedPath === item.pagePath ? SELECTED_COLOR : NORMAL_COLOR, }} > {item.text} </View> </CoverView> ) })} </CoverView> ) } } [图片][图片]
2021-08-12