// 底部tab active状态保持
import HomeIcon from '../../assets/icon/首页.png';
const HomeIconActive = require('@/assets/icon/首页-选中.png');
const WorkbenchIcon = require('@/assets/icon/工作台.png');
const WorkbenchIconActive = require('@/assets/icon/工作台-选中.png');
const AlarmIcon = require('@/assets/icon/报警.png');
const AlarmIconActive = require('@/assets/icon/报警-选中.png');
const MineIcon = require('@/assets/icon/我的.png');
const MineIconActive = require('@/assets/icon/我的-选中.png');
console.log(HomeIcon)
const TAB_LIST = [
{ name: 'index', label: '首页', icon: HomeIcon, iconActive: HomeIconActive },
{ name: 'workbench', label: '工作台', icon: WorkbenchIcon, iconActive: WorkbenchIconActive },
{ name: 'alarm', label: '报警', icon: AlarmIcon, iconActive: AlarmIconActive },
{ name: 'mine', label: '我的', icon: MineIcon, iconActive: MineIconActive },
];
...
<view v-for="tab in tabs" :key="tab.name" class="action"
@click="NavChange(tab)">
<view class="cuIcon-cu-image">
<image :src="currentTab === tab ? tab.iconActive : tab.icon" ></image>
</view>
<view :class="currentTab === tab ? 'text-green' : 'text-gray'">
{{ tab.label }}
</view>
</view>
我这样用也不行, 求解决办法
3***@qq.com
可以了,谢谢大哥!!
2020-06-16 09:34