【原 因】:防止 重复点击按钮 【过 程】:给支付按钮加一个标记 点击之后改变按钮样式 并且标记点击过 点击过 则不继续执行pay 函数 【影 响】: # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
65 lines
1.2 KiB
Vue
65 lines
1.2 KiB
Vue
<template>
|
|
<view>
|
|
<u-tabbar :value="current" @change="handleTabChange" :fixed="true" :placeholder="true"
|
|
:safeAreaInsetBottom="true" activeColor="#D43030">
|
|
<u-tabbar-item v-for="(item,index) in tabList" :key="index" class="fz28" :text="item.name"
|
|
:icon="item.icon"></u-tabbar-item>
|
|
</u-tabbar>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "tabbar",
|
|
data() {
|
|
return {
|
|
tabList: [ //tabbar列表
|
|
{
|
|
'name': '首页',
|
|
'icon': 'home'
|
|
},
|
|
{
|
|
'name': '点餐',
|
|
'icon': 'grid'
|
|
},
|
|
{
|
|
'name': '我的',
|
|
'icon': 'account'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
computed: {
|
|
current() {
|
|
return this.$store.state.tabbarCurrent
|
|
}
|
|
},
|
|
methods: {
|
|
handleTabChange(name) {
|
|
// 更新当前选中的 tab 索引
|
|
if (this.current === name) {
|
|
return
|
|
}
|
|
this.$store.commit('setTabbarCurrent', name)
|
|
if (name === 0) {
|
|
uni.redirectTo({
|
|
url: '/pages/index/index'
|
|
})
|
|
} else if (name === 1) {
|
|
uni.navigateTo({
|
|
url: '/pages/shop/list'
|
|
})
|
|
|
|
} else if (name === 2) {
|
|
uni.navigateTo({
|
|
url: '/pages/main/index'
|
|
})
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style> |