效果:
代码如下:
//给每一项添加一个tab有数字的属性
res.forEach(item => {
item.haveNum = (h) => {
return h('div', [
h('span', item.txt),
h('Badge', {
props: {
count: item.num
}
})
])
}
})
然后给tabpane添加label属性,如下:
<TabPane v-for="(tab, tabIndex) in tabList" :key="tabIndex" :label="tab.haveNum" :name="tab.txt">