123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <!-- 底部tabbar -->
- <view class="navmainbox">
- <view class="navigation">
- <view class="navcont" v-for="(item,index) in dataList" :key="index" @click="gonavs(item,index)">
- <span class="iconfont icon_image" :class="[item.icon,nowchos == index ? 'activeName' :'']"></span>
- <view class="navchosbox" :class="nowchos == index ? 'activeName' :''">
- {{item.title}}
- </view>
- </view>
- </view>
- <!-- //防止 固定的底部菜单遮挡页面上的内容 -->
- <view class="navmainbox" style="position: relative;opacity: 0;z-index: 0;">
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'x-navbottom',
- props: {
- nowchos: {
- type: Number,
- default () {
- return 0
- }
- },
- },
- data() {
- return {
- dataList: [],
- list: [{
- icon: 'icon-shouye1',
- title: '首页',
- }, {
- icon: 'icon-dingdan2',
- title: '订单',
- },
- {
- icon: 'icon-yehuaqiping',
- title: '我的钢瓶',
- },
- {
- icon: 'icon-icon-test',
- title: '我的',
- }
- ],
- gasList: [{
- icon: 'icon-shouye1',
- title: '首页',
- }, {
- icon: 'icon-yehuaqiping',
- title: '我的钢瓶',
- }, {
- icon: 'icon-icon-test',
- title: '我的',
- }],
- }
- },
- mounted() {
- var userInfo = this.$cache.getCache('userInfo')
- if (userInfo.provUser) {
- if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {
- this.dataList = this.list
- } else {
- this.dataList = this.gasList
- }
- } else {
- this.dataList = this.list
- }
- },
- methods: {
- gonavs(e, cindex) {
- this.$emit('botomchos', cindex)
- }
- }
- }
- </script>
- <style lang="scss">
- .navmainbox {
- position: fixed;
- bottom: 0;
- left: 0;
- z-index: 5;
- background-color: #ffffff;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
- width: 100%;
- height: 100rpx;
- padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
- padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
- }
- .navigation {
- z-index: 2024;
- position: relative;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100rpx;
- padding-bottom: var(--window-bottom);
- }
- .navigation .navcont {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- flex: 1;
- }
- .navchosbox {
- color: #727289 !important;
- margin-top: 2rpx;
- font-size: 26rpx;
- }
- .activeName {
- color: #3C9CFE !important;
- }
- .icon_image {
- color: #606266;
- font-size: 44rpx;
- }
- </style>
|