123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <van-tabbar class="u-tabbar" :active="tabbarActive" @change="onChange" :placeholder="true" active-color="#E57519"
- inactive-color="#7D7D7D">
- <template v-for="(item, index) in list">
- <van-tabbar-item v-if="index !== 2" :name="item.name" :key="index" :icon="item.icon" icon-prefix="tabbar-icon">
- {{ item.text }}
- </van-tabbar-item>
- <template v-else>
- <view class="tabbar-center-item" :class="{ 'active': tabbarActive === item.name } " hover-class="active"
- @click="onClickCenter">
- <view class="tabbar-center-round">
- <view>
- <van-icon :name="item.icon" class-prefix="tabbar-icon" />
- </view>
- </view>
- <view class="tabbar-center-text">
- {{ item.text }}
- </view>
- </view>
- </template>
- </template>
- </van-tabbar>
- </template>
- <script>
- import VanTabbar from '@/wxcomponents/vant/tabbar/index'
- import VanTabbarItem from '@/wxcomponents/vant/tabbar-item/index'
-
- export default {
- options: {
- styleIsolation: 'shared'
- },
- components: {
- VanTabbar,
- VanTabbarItem
- },
- props: {
- active: String
- },
- watch: {
- active(val) {
- this.tabbarActive = val
- }
- },
- data() {
- return {
- tabbarActive: 'home',
- list: [{
- name: 'home',
- icon: 'home',
- text: '首页',
- url: '/pages/index'
- }, {
- name: 'exhibitor',
- icon: 'exhibitor',
- text: '展商',
- url: '/pages/signup/signup'
- },
- {
- name: 'registration',
- icon: 'registration',
- text: '观众预登记',
- url: '/pages/test'
- },
- {
- name: 'activity',
- icon: 'activity',
- text: '同期活动',
- url: '/pages/test'
- },
- {
- name: 'user',
- icon: 'user',
- text: '个人中心',
- url: '/pages/test'
- }
- ]
- }
- },
- created() {
- this.tabbarActive = this.active
- },
- methods: {
- onChange(active) {
- this.tabbarActive = active
- this.$emit('update:active', active)
- this.$emit('change', active)
- },
- onClickCenter() {
- this.showAlertDialog('功能未开通')
- }
- }
- }
- </script>
- <style lang="scss">
- .u-tabbar{
- .van-tabbar{
- height: 118rpx;
- }
- .van-tabbar-item{
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding-top: 16rpx;
- padding-bottom: 16rpx;
- }
- .van-tabbar-item__icon{
- margin-bottom: 0;
- }
- .van-tabbar-item__text {
- font-size: $fontSize3;
- color: #7D7D7D;
- }
-
- .van-tabbar-item--active {
- .van-tabbar-item__text {
- color: $textActionColor;
- }
- }
-
- .tabbar-center-item {
- position: relative;
- top: -50rpx;
- z-index: 1;
- flex: 1;
-
- &.active {
- .tabbar-center-text {
- color: $textActionColor;
- }
- }
- }
-
- .tabbar-center-text {
- font-size: $fontSize3;
- color: #7D7D7D;
- margin-top: 18rpx;
- text-align: center;
- }
-
- .tabbar-center-round {
- @include display-flex-center;
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- background-color: $buttonPrimaryColor;
- margin: auto;
-
- &>view {
- @include display-flex-center;
- width: 96rpx;
- height: 96rpx;
- border-radius: 50%;
- border: 1rpx solid #FFFFFF;
- color: #FFFFFF;
- background-color: $buttonPrimaryColor;
-
- .tabbar-icon {
- font-size: 60rpx;
- }
- }
- }
-
- .tabbar-icon-activity {
- font-size: 40rpx;
- }
-
- .tabbar-icon-user {
- font-size: 46rpx;
- }
- }
- </style>
|