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">
|
|
|
|
<li v-for="item in tabComponent.list" :key="item.id" @click='tabComponent.iconHandler(item)'>
|
|
|
|
<img :src="current===item.id?item.checkedSrc:item.src" alt="">
|
|
|
|
<p>{{item.text}}</p>
|
|
|
|
</li>
|
|
|
|
</ul>`,
|
|
|
|
props: {
|
2022-09-22 14:08:22 +08:00
|
|
|
/* 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-22 14:08:22 +08:00
|
|
|
/* tab数据列表 */
|
2022-09-21 18:35:54 +08:00
|
|
|
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-22 14:08:22 +08:00
|
|
|
/* 根据不同icon进行跳转 */
|
2022-09-21 18:35:54 +08:00
|
|
|
iconHandler(item) {
|
|
|
|
window.location.replace(item.link)
|
2022-09-21 17:30:39 +08:00
|
|
|
}
|
2022-09-21 18:35:54 +08:00
|
|
|
}
|