main
parent
4ec509a9bc
commit
af3979d5b2
@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<view class="tabbar-container">
|
||||
<block>
|
||||
<view class="tabbar-item" v-for="(item, index) in tabbarList"
|
||||
@click="changeItem(item)">
|
||||
<view class="item-top">
|
||||
<image :style="{width:item.width+'rpx',height:item.height+'rpx'}"
|
||||
:src="currentItem == item.id ? item.selectedIconPath : item.iconPath"></image>
|
||||
</view>
|
||||
<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
|
||||
<text>{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
currentPage: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentItem: 0,
|
||||
tabbarList: [{
|
||||
id: 0,
|
||||
centerItem: false,
|
||||
width: 73,
|
||||
height: 70,
|
||||
"text": "首页",
|
||||
"pagePath": "/pages/index/index",
|
||||
"iconPath": require("@/static/index-home.png"),
|
||||
"selectedIconPath": require("@/static/index-home-cur.png")
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
centerItem: false,
|
||||
width: 59,
|
||||
height: 69,
|
||||
"text": "我的",
|
||||
"pagePath": "/pages/me/me",
|
||||
"iconPath": require("@/static/index-me.png"),
|
||||
"selectedIconPath": require("@/static/index-me-cur.png")
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.currentItem = this.currentPage;
|
||||
uni.hideTabBar();
|
||||
},
|
||||
methods: {
|
||||
changeItem(item) {
|
||||
let _this = this;
|
||||
console.log(item.pagePath)
|
||||
//_this.currentItem = item.id;
|
||||
|
||||
uni.switchTab({
|
||||
url: item.pagePath
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
view {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tabbar-container {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
box-shadow: 0 0 10px #999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
color: #6E6E6E;
|
||||
z-index: 9999;
|
||||
background: #fff;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.tabbar-container .tabbar-item {
|
||||
width: 50%;
|
||||
/* height: 100rpx; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* justify-content: center; */
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tabbar-container .item-active {
|
||||
color: #e83f46;
|
||||
}
|
||||
|
||||
.tabbar-container .center-item {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tabbar-container .tabbar-item .item-top {
|
||||
/* width: 56rpx;
|
||||
height: 44rpx; */
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
|
||||
.tabbar-container .tabbar-item .item-top image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.tabbar-container .tabbar-item .item-bottom {
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tabbar-container .center-item .item-bottom {
|
||||
position: absolute;
|
||||
bottom: 5rpx;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<web-view v-if="url" :src="url"></web-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: '' // 指定要打开的H5页面的URL
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.url = option.url?option.url:''
|
||||
console.log(this.url)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 297 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
Loading…
Reference in new issue