home.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <div class="container">
  3. <transition name="fade" mode="out-in">
  4. <!-- <keep-alive> -->
  5. <router-view @iconNum="iconNum" ref='routerList'></router-view>
  6. <!-- </keep-alive> -->
  7. </transition>
  8. <yd-tabbar :fixed="true" style="z-index: 999999;" color="#666" v-if="$route.meta.tabberShow">
  9. <yd-tabbar-item title="需求发布" link="/need/cache">
  10. <yd-icon name="need" custom slot="icon" size="0.6rem"></yd-icon>
  11. <yd-badge slot="badge" type="danger" v-text="needCache" v-if="needCache"></yd-badge>
  12. </yd-tabbar-item>
  13. <yd-tabbar-item title="常买清单" link="/bill"><yd-icon name="likes" custom slot="icon" size="0.6rem"></yd-icon></yd-tabbar-item>
  14. <yd-tabbar-item title="订单" link="/order">
  15. <yd-icon name="orders" custom slot="icon" size="0.6rem"></yd-icon>
  16. <yd-badge slot="badge" type="danger" v-text="orderNum" v-if="orderNum"></yd-badge>
  17. </yd-tabbar-item>
  18. <yd-tabbar-item title="我的" link="/personal" :active="active"><yd-icon name="my" custom slot="icon" size="0.6rem"></yd-icon></yd-tabbar-item>
  19. </yd-tabbar>
  20. </div>
  21. </template>
  22. <script>
  23. import request from '@/utils/request';
  24. export default {
  25. props:['orderNum'],
  26. data() {
  27. return {
  28. active: false,
  29. needCache: ''
  30. };
  31. },
  32. created() {
  33. var _this = this;
  34. this.$root.$on('cacheList', function(res) {
  35. typeof res == 'function' && res(_this.$refs);
  36. });
  37. },
  38. methods: {
  39. iconNum(obj) {
  40. this[obj.name] = obj.num;
  41. }
  42. }
  43. };
  44. </script>