123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <template>
- <view>
- <view class="bottom_tabbar">
- <view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)">
- <image :src="tabbarIndex===index?item.activeImg:item.inactiveImg"></image>
- <text :class="tabbarIndex===index?'on':''">{{item.text}}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- tabbarIndex: 0
- },
- data() {
- return {
- tabbarValue: 0,
- list: [{
- inactiveImg: './../../static/imgs/tabbar/icon1.png',
- activeImg: './../../static/imgs/tabbar/icon1_on.png',
- text: '首页',
- path: '/pages/index/index'
- },
- {
- inactiveImg: './../../static/imgs/tabbar/icon2.png',
- activeImg: './../../static/imgs/tabbar/icon2_on.png',
- text: '方案',
- path: '/pages/plan/index'
- },
- {
- inactiveImg: './../../static/imgs/tabbar/icon3.png',
- activeImg: './../../static/imgs/tabbar/icon3_on.png',
- text: '联系我们',
- path: '/pages/consult/index'
- },
- ],
- }
- },
- mounted() {
- this.tabbarValue = this.tabbarIndex;
- },
- methods: {
- changeTabbar(e) {
- if (!this.list[e].path) return this.$showToast('正在开发中...')
- this.tabbarValue = e;
- uni.reLaunch({
- url: this.list[e].path
- })
- }
- }
- }
- </script>
- <style scoped lang="less">
- .bottom_tabbar {
- width: 100%;
- height: 120rpx;
- background: #FFFFFF;
- // box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.08);
- // border-radius: 60rpx;
- display: flex;
- align-items: center;
- justify-content: space-around;
- position: fixed;
- left: 0;
- bottom: 0;
- background-color: #fff;
- z-index: 9;
- // 底部安全区域
- box-sizing: content-box;
- padding-bottom: 0 !important;
- padding-bottom: constant(safe-area-inset-bottom) !important;
- padding-bottom: env(safe-area-inset-bottom) !important;
- &>view {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- image {
- width: 48rpx;
- height: 48rpx;
- }
- text {
- margin-top: 8rpx;
- font-size: 24rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- color: #666666;
- &.on{
- color: #385FDF;
- font-weight: bold;
- }
- }
- }
- }
- </style>
|