2022-04-23 23:13:29 +08:00
|
|
|
|
<template>
|
2022-03-15 17:38:58 +08:00
|
|
|
|
<!-- 底部fixed操作条,包含发布选项,普通文字加icon加标签选项 -->
|
|
|
|
|
|
<view class="cu-bar tabbar margin-bottom-xl bg-white fixed-bottom-bar">
|
2022-04-23 23:13:29 +08:00
|
|
|
|
<view class="action add-action"
|
|
|
|
|
|
v-for="(item, index) in moduleBarInfos" :key="index"
|
|
|
|
|
|
v-if="item.action === 'add'"
|
|
|
|
|
|
:data-cur="item.pageCode"
|
|
|
|
|
|
:class="[curPageCode===item.pageCode ? 'text-main-color' : 'text-gray']"
|
|
|
|
|
|
@click="navChange($event, false)">
|
|
|
|
|
|
<button class="cu-btn shadow bg-main-color"
|
|
|
|
|
|
:class="['cuIcon-' + item.cuIcon]">
|
|
|
|
|
|
</button>
|
2022-03-15 17:38:58 +08:00
|
|
|
|
{{item.name}}
|
|
|
|
|
|
</view>
|
2022-04-23 23:13:29 +08:00
|
|
|
|
<view class="action" v-else
|
|
|
|
|
|
:data-cur="item.pageCode"
|
|
|
|
|
|
:class="curPageCode===item.pageCode ? 'text-main-color' : 'text-gray'"
|
|
|
|
|
|
@click="navChange($event, true)">
|
2022-03-15 17:38:58 +08:00
|
|
|
|
<view :class="'cuIcon-' + item.cuIcon">
|
|
|
|
|
|
<view class="cu-tag badge" v-if="item.countTag">{{item.countTag > 99 ? '99+' : item.countTag}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
{{item.name}}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
2022-07-01 22:31:45 +08:00
|
|
|
|
name: "module-bar",
|
|
|
|
|
|
emits: ['getCurPageInfo'],
|
2022-03-15 17:38:58 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
moduleBarInfos: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
2022-04-23 23:13:29 +08:00
|
|
|
|
return {
|
|
|
|
|
|
curPageCode: ''
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
onReady() {
|
|
|
|
|
|
this.loadData();
|
2022-03-15 17:38:58 +08:00
|
|
|
|
},
|
2022-04-23 23:13:29 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
loadData() {
|
|
|
|
|
|
this.curPageCode = this.moduleBarInfos[0].pageCode;
|
|
|
|
|
|
},
|
|
|
|
|
|
navChange(e, isChangeFocus) {
|
|
|
|
|
|
let cur = e.currentTarget.dataset.cur;
|
|
|
|
|
|
this.curPageCode = isChangeFocus ? cur : this.curPageCode;
|
2022-07-01 22:31:45 +08:00
|
|
|
|
this.$emit('getCurPageInfo', {
|
2022-04-23 23:13:29 +08:00
|
|
|
|
curPageCode: cur
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2022-03-15 17:38:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2022-03-18 17:13:24 +08:00
|
|
|
|
<style>
|
2022-03-15 17:38:58 +08:00
|
|
|
|
</style>
|