building-sign/components/sub-nav/sub-nav.vue

43 lines
867 B
Vue

<template>
<view class="sub-nav bg-white">
<view class="item font32" :class="curIndex==index?'color-blue':''" @tap="changeEv(index)" v-for="(item,index) in subNavList" :key="index">{{item}}</view>
</view>
</template>
<script>
import { mapState } from 'vuex'; //引入mapState
export default {
name:'tabbar',
data() {
return {
subNavList:['待确认','已确认'],
curIndex:0
};
},
methods:{
// 选择栏目
changeEv(index){
if(index!==this.curIndex){
this.curIndex = index;
// 传值
this.$emit("changeEv", index);
}
}
}
}
</script>
<style scoped>
.sub-nav{
display: flex;
align-items: center;
padding: 0 30rpx;
}
.sub-nav .item{
display: flex;
justify-content: center;
align-items: center;
width: 50%;
height: 80rpx;
}
</style>