Commit 9bab9df2 authored by 罗超's avatar 罗超

优化标签

parent 479a669f
<template> <template>
<view class="tabbarMain" :style="{paddingBottom: `${bottomSafeHeight}px`}" v-if="navs.length"> <view class="tabbarMain" :style="{paddingBottom: `${bottomSafeHeight}px`}" v-if="navs.length && isExsits">
<view class="tabBtnMina"> <view class="tabBtnMina">
<view <view
class="itmMain" class="itmMain"
v-for="(x, i) in navs" v-for="(x, i) in navs"
:key="i" :key="i"
@click.stop="goUrl(x.url)" @click.stop="goUrl(x.url)"
> >
<image <image
class="imgse" class="imgse"
:src="active === i ? x.active_icon : x.icon" :src="active === i ? x.active_icon : x.icon"
mode="aspectFit" mode="aspectFit"
/> />
<text class="txtBtn" :style="{ color: active == i ? x.active_color : x.color }"> <text class="txtBtn" :style="{ color: active == i ? x.active_color : x.color }">
{{ x.text }} {{ x.text }}
</text> </text>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
...@@ -27,7 +27,8 @@ export default { ...@@ -27,7 +27,8 @@ export default {
active: 0, active: 0,
navs: [], navs: [],
bottomSafeHeight: 0, bottomSafeHeight: 0,
currentPath:'' currentPath:'',
isExsits:true
}; };
}, },
mounted() { mounted() {
...@@ -48,12 +49,12 @@ export default { ...@@ -48,12 +49,12 @@ export default {
.map(key => `${key}=${query[key]}`) .map(key => `${key}=${query[key]}`)
.join('&') .join('&')
this.currentPath = `/${currentPage.route}${queryString ? '?' + queryString : ''}` this.currentPath = `/${currentPage.route}${queryString ? '?' + queryString : ''}`
this.navs.forEach((item, index) => { this.navs.forEach((item, index) => {
if (this.currentPath === item.url) { if (this.currentPath === item.url) {
this.active = index this.active = index
} }
}) })
this.isExsits = this.navs.findIndex(x=>x.url == this.currentPath)!=-1
}, },
goUrl(url) { goUrl(url) {
if (this.currentPath !== url) { if (this.currentPath !== url) {
......
...@@ -294,7 +294,10 @@ ...@@ -294,7 +294,10 @@
data: parameter, data: parameter,
}, },
(res) => { (res) => {
this.myPageData = res.data; this.myPageData = res.data;
if(this.pageId==0){
uni.setStorageSync('navs',this.myPageData.navbar.navs)
}
uni.setStorageSync("basedata", res.data); uni.setStorageSync("basedata", res.data);
if (res.data && res.data.mall && res.data.mall.setting) { if (res.data && res.data.mall && res.data.mall.setting) {
this.setting = res.data.mall.setting; this.setting = res.data.mall.setting;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment