You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.4 KiB
129 lines
3.4 KiB
<template>
|
|
<view class="u-page__item">
|
|
<su-tabbar :value="path" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
|
|
:inactiveColor="tabbar.style.color" :activeColor="tabbar.style.activeColor" :midTabBar="tabbar.mode === 2"
|
|
:customStyle="tabbarStyle">
|
|
<!-- <su-tabbar-item
|
|
v-for="(item, index) in tabbar.items"
|
|
:key="item.text"
|
|
:text="item.text"
|
|
:name="item.url"
|
|
:isCenter="getTabbarCenter(index)"
|
|
:centerImage="sheep.$url.cdn(item.iconUrl)"
|
|
@tap="sheep.$router.go(item.url)"
|
|
>
|
|
<template v-slot:active-icon>
|
|
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.activeIconUrl)"></image>
|
|
</template>
|
|
<template v-slot:inactive-icon>
|
|
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.iconUrl)"></image>
|
|
</template>
|
|
</su-tabbar-item> -->
|
|
<su-tabbar-item v-for="(item, index) in tabbar_list" :key="item.text" :text="item.text" :name="item.url"
|
|
:isCenter="getTabbarCenter(index)" :centerImage="sheep.$url.cdn(item.iconUrl)"
|
|
@tap="handle_gosheep(item)">
|
|
<template v-slot:active-icon>
|
|
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.activeIconUrl)"></image>
|
|
</template>
|
|
<template v-slot:inactive-icon>
|
|
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.iconUrl)"></image>
|
|
</template>
|
|
</su-tabbar-item>
|
|
</su-tabbar>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
computed,
|
|
unref
|
|
} from 'vue';
|
|
import sheep from '@/sheep';
|
|
|
|
const tabbar = computed(() => {
|
|
return sheep.$store('app').template.basic?.tabbar;
|
|
});
|
|
const tabbar_list = [{
|
|
activeIconUrl: "http://mall.yudao.iocoder.cn/static/images/1-002.png",
|
|
iconUrl: "http://mall.yudao.iocoder.cn/static/images/1-001.png",
|
|
text: "首页",
|
|
url: "/pages/home/index"
|
|
},
|
|
{
|
|
activeIconUrl: "http://mall.yudao.iocoder.cn/static/images/1-002.png",
|
|
iconUrl: "http://mall.yudao.iocoder.cn/static/images/1-001.png",
|
|
text: "扫码",
|
|
url: ""
|
|
},
|
|
{
|
|
activeIconUrl: "http://mall.yudao.iocoder.cn/static/images/1-002.png",
|
|
iconUrl: "http://mall.yudao.iocoder.cn/static/images/1-001.png",
|
|
text: "我的",
|
|
url: "/pages/index/user"
|
|
},
|
|
]
|
|
const tabbarStyle = computed(() => {
|
|
const backgroundStyle = tabbar.value.style;
|
|
if (backgroundStyle.bgType === 'color') {
|
|
return {
|
|
background: backgroundStyle.bgColor
|
|
};
|
|
}
|
|
if (backgroundStyle.bgType === 'img')
|
|
return {
|
|
background: `url(${sheep.$url.cdn(
|
|
backgroundStyle.bgImg,
|
|
)}) no-repeat top center / 100% auto`,
|
|
};
|
|
});
|
|
|
|
const getTabbarCenter = (index) => {
|
|
if (unref(tabbar).mode !== 2) return false;
|
|
return unref(tabbar).items % 2 > 0 ?
|
|
Math.ceil(unref(tabbar).items.length / 2) === index + 1 :
|
|
false;
|
|
};
|
|
const handle_gosheep = (data) => {
|
|
if (data.text == '扫码') {
|
|
console.log('开始扫码')
|
|
} else {
|
|
sheep.$router.go(data.url)
|
|
}
|
|
}
|
|
const props = defineProps({
|
|
path: String,
|
|
default: '',
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.u-page {
|
|
padding: 0;
|
|
|
|
&__item {
|
|
&__title {
|
|
color: var(--textSize);
|
|
background-color: #fff;
|
|
padding: 15px;
|
|
font-size: 15px;
|
|
|
|
&__slot-title {
|
|
color: var(--textSize);
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
|
|
&__slot-icon {
|
|
width: 25px;
|
|
height: 25px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.iscicle {
|
|
// position: absolute;
|
|
// top: -50rpx;
|
|
// left: 50%;
|
|
// transform: translateX(-50%);
|
|
}
|
|
</style> |