12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <!-- 使用得时候必须加上style 不然没有--colorxxxxx之类得变量 -->
- <view class="tabbar align-center" :style="$store.state.theme.currentMoban">
- <view v-for="(item, index) in tabbarList" :key="index" @click="switchTabs(item)" class="tablist">
- <view class="column align-center justify-center" >
- <image :src="actindex==index?item.selectedIconPath:item.iconPath" class="w48 h48"></image>
- <text class="fs24 base-textcol" :class="actindex==index?'actcolor':'morecolor'">{{item.Text}}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "tabbar",
- props: {
- actindex: {
- type: Number,
- default: 0
- }
- },
- data() {
- return {
- themes: 'beiliyou',
- tabbarList: [],
- };
- },
- mounted() {
- this.themeicon()
- console.log(this.$store.state.theme.currentMoban['--base-color'])
- },
- methods: {
- switchTabs(item) {
- // 到时候要设置两个tabbar 但是一教育页面得隐藏掉 这里得页面不能配置到tabbar得list里面
-
- uni.navigateTo({
- url: item.url
- })
- },
- themeicon() {
- const theme = this.themes
- this.tabbarList = [{
- iconPath: `/static/images/tabbar/${theme}/home.png`,
- selectedIconPath: `/static/images/tabbar/${theme}/home_on.png`,
- Text: '首页',
- url: '/pages/home/index'
- },
- {
- iconPath: `/static/images/tabbar/${theme}/ENCYCLOPEDIA.png`,
- selectedIconPath: `/static/images/tabbar/${theme}/ENCYCLOPEDIA_on.png`,
- Text: '企业理念',
- url: '/pages/enterprise/enterprise'
- },
- {
- iconPath: `/static/images/tabbar/${theme}/mall.png`,
- selectedIconPath: `/static/images/tabbar/${theme}/mall_on.png`,
- Text: '健康商城',
- url: '/pages/shopping/index'
- },
- {
- iconPath: `/static/images/tabbar/${theme}/mine.png`,
- selectedIconPath: `/static/images/tabbar/${theme}/mine_on.png`,
- Text: '会员中心',
- url: '/pages/user/index'
- },
- ]
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .tabbar {
- display: flex;
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- background-color: #fff;
- z-index: 1000;
- height: 100rpx;
- }
- .tablist {
- width: 25%;
- }
- .morecolor{
- color: #626468;
- }
- .actcolor {
- color: #018C39;
- }
- </style>
|