123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <view class="">
- <u-tabbar
- :value="tabbarValue"
- @change="tabbarChange"
- :fixed="true"
- :placeholder="true"
- :border="false"
- inactiveColor="#666"
- activeColor="#00A447"
- :safeAreaInsetBottom="true"
- >
- <u-tabbar-item text="商城" >
- <image
- class="u-page__item__slot-icon"
- slot="active-icon"
- :src="staticUrl+'/img/tabbar-mall.png'"
- ></image>
- <image
- class="u-page__item__slot-icon"
- slot="inactive-icon"
- :src="staticUrl+'/img/tabbar-mall-gray.png'"
- ></image>
- </u-tabbar-item>
- <u-tabbar-item text="分类" >
- <image
- class="u-page__item__slot-icon"
- slot="active-icon"
- :src="staticUrl+'/img/tabbar-classify.png'"
- ></image>
- <image
- class="u-page__item__slot-icon"
- slot="inactive-icon"
- :src="staticUrl+'/img/tabbar-classify-gray.png'"
- ></image>
- </u-tabbar-item>
- <u-tabbar-item text="关于旭烁" >
- <image
- class="u-page__item__slot-icon"
- slot="active-icon"
- :src="staticUrl+'/img/tabbar-xushuo-v2.png'"
- ></image>
- <image
- class="u-page__item__slot-icon"
- slot="inactive-icon"
- :src="staticUrl+'/img/tabbar-xushuo-v2-gray.png'"
- ></image>
- </u-tabbar-item>
- <!-- <u-tabbar-item text="购物车" >
- <image
- class="u-page__item__slot-icon"
- slot="active-icon"
- src="/static/img/tabbar-car.png"
- ></image>
- <image
- class="u-page__item__slot-icon"
- slot="inactive-icon"
- src="/static/img/tabbar-car-gray.png"
- ></image>
- </u-tabbar-item> -->
- <u-tabbar-item text="我的" >
- <image
- class="u-page__item__slot-icon"
- slot="active-icon"
- :src="staticUrl+'/img/tabbar-my.png'"
- ></image>
- <image
- class="u-page__item__slot-icon"
- slot="inactive-icon"
- :src="staticUrl+'/img/tabbar-my-gray.png'"
- ></image>
- </u-tabbar-item>
- </u-tabbar>
- </view>
- </template>
- <script>
- export default {
- name: 'tabbar',
- props:{
- tabbarIndexProps:{
- type:Number,
- default:0
- },
- },
- data() {
- return {
- staticUrl:this.$commonConfig.staticUrl,
- tabbarValue:0,
- }
- },
- watch:{
- 'tabbarIndexProps': {
- handler(newVal, oldVal) {
- this.tabbarValue = newVal
- },
- immediate: true
- }
- },
- onLoad() {
- console.log('onLoad tabbarIndex',this.tabbarIndex);
- },
- onShow() {
- console.log('tabbarIndex',this.tabbarIndex);
- this.tabbarValue = this.tabbarIndex
- },
- methods: {
- tabbarChange(name){
- console.log('name====',name);
- const tabBarRoutes = {
- 0: '/pages/index/index',
- 1: {
- url: '/shopping/producTypetList',
- query: {
- type: 'redirect'
- }
- },
- 2: '/xushuo/xushuo',
- // 3: '/shopping/cart',
- 3: '/center/center'
- };
-
- const targetRoute = tabBarRoutes[name];
-
- if (typeof targetRoute === 'string') {
- uni.$u.route(targetRoute,{type: 'redirect'});
- } else if (typeof targetRoute === 'object') {
- uni.$u.route(targetRoute.url, targetRoute.query);
- }
- // this.tabbarValue = name
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .u-page__item__slot-icon{
- width: 60rpx;
- height: 60rpx;
- &.big{
- transform: scale(1.5) translateY(-0.5em);
- }
- }
- </style>
|