mobileclient/v1_5_0_C/tabbar.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-09-21 18:35:54 +08:00
const tabComponent = {
2022-09-21 17:30:39 +08:00
template: `
2022-09-21 18:35:54 +08:00
<ul class="tabList">
2022-09-23 11:48:51 +08:00
<li v-for="item in list" :key="item.id" @click='iconHandler(item)'>
2022-09-21 18:35:54 +08:00
<img :src="current===item.id?item.checkedSrc:item.src" alt="">
<p>{{item.text}}</p>
</li>
</ul>`,
2022-09-23 11:48:51 +08:00
data() {
return {
list: [
{
id: 1,
src: "./img/home.png",
checkedSrc: "./img/checked_home.png",
link: "./couponCollection.html",
text: "首页"
},
{
id: 2,
src: "./img/order.png",
checkedSrc: "./img/checked_order.png",
link: "./myOrder.html",
text: "订单"
},
{
id: 3,
src: "./img/coupon.png",
checkedSrc: "./img/checked_coupon.png",
link: "./myCoupon.html",
text: "我的券"
}
]
}
},
2022-09-21 18:35:54 +08:00
props: {
/* tab选中下标 */
2022-09-21 18:35:54 +08:00
current: {
type: Number,
default: 1
2022-09-21 17:30:39 +08:00
}
2022-09-21 18:35:54 +08:00
},
2022-09-23 11:48:51 +08:00
methods: {
/* 根据不同icon进行跳转 */
iconHandler(item) {
window.location.replace(item.link)
2022-09-21 18:35:54 +08:00
}
2022-09-21 17:30:39 +08:00
}
2022-09-21 18:35:54 +08:00
}