Files
dvcp_v2_wxcp_app/library/project/saas/AppHomeOld/AppHomeOld.vue
2024-10-31 14:34:57 +08:00

133 lines
2.8 KiB
Vue

<template>
<div class="AppHomeOld">
<component v-if="refresh" :is="component" @change="onChange" :params="params"></component>
<div class="tabs">
<div class="item" @click="tabClick(index, item.component)" v-for="(item, index) in tabs" :key="index">
<img :src="tabIndex == index ? item.activeImg : item.img" alt=""/>
<p :class="tabIndex == index ? 'color-3267F0' : ''">{{ item.text }}</p>
</div>
</div>
</div>
</template>
<script>
import home from './home.vue'
import application from './application.vue'
import statistics from './statistics.vue'
import my from './my.vue'
export default {
name: 'AppHomeOld',
appName: '首页',
provide() {
return {top: this}
},
data() {
return {
component: 'home',
params: {},
refresh: true,
tabIndex: 0,
tabs: [
{
img: require('./components/img/home-icon.png'),
activeImg: require('./components/img/home-icon-active.png'),
text: '首页',
component: 'home',
},
{
img: require('./components/img/app-icon.png'),
activeImg: require('./components/img/app-icon-active.png'),
text: '应用',
component: 'application',
},
{
img: require('./components/img/statistics-icon.png'),
activeImg: require('./components/img/statistics-icon-active.png'),
text: '统计',
component: 'statistics',
},
{
img: require('./components/img/my-icon.png'),
activeImg: require('./components/img/my-icon-active.png'),
text: '我的',
component: 'my'
},
],
isTab: true,
}
},
onShow() {
this.refreshHome()
},
components: {
home,
application,
statistics,
my,
},
methods: {
onChange(e) {
this.params = e.params
this.component = e.type
},
tabClick(index, component) {
this.tabIndex = index
this.component = component
this.refreshHome()
},
refreshHome() {
this.refresh = false
this.$nextTick(() => {
this.refresh = true
})
},
linkTo(url) {
uni.navigateTo({url})
},
},
}
</script>
<style lang="scss" scoped>
.AppHomeOld {
height: 100%;
.tabs {
width: 100%;
height: 98px;
background: #fff;
border-top: 1px solid #ddd;
position: fixed;
bottom: 0;
left: 0;
display: flex;
z-index: 999;
.item {
flex: 1;
text-align: center;
img {
width: 56px;
height: 56px;
margin-top: 8px;
}
p {
font-size: 22px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #c4cad4;
line-height: 8px;
}
.color-3267F0 {
color: #3267f0;
}
}
}
}
</style>