LayoutComponent.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div>
  3. <keep-alive>
  4. <router-view></router-view>
  5. </keep-alive>
  6. <wv-tabbar>
  7. <wv-tabbar-item to="/" is-on>
  8. <span slot="icon" style="display: inline-block; position: relative;">
  9. <img class="weui-tabbar__icon" src="icon.png" slot="icon">
  10. <wv-badge style="position: absolute;top: -2px;right: -13px;">8</wv-badge>
  11. </span> 首页
  12. </wv-tabbar-item>
  13. <wv-tabbar-item to="/tabbar">
  14. <img class="weui-tabbar__icon" src="icon.png" slot="icon"> 通讯录
  15. </wv-tabbar-item>
  16. <wv-tabbar-item to="/">
  17. <span slot="icon" style="display: inline-block; position: relative;">
  18. <img class="weui-tabbar__icon" src="icon.png" slot="icon">
  19. <wv-badge is-dot style="position: absolute;top: 0;right: -6px;">8</wv-badge>
  20. </span>
  21. 发现
  22. </wv-tabbar-item>
  23. <wv-tabbar-item to="/profile">
  24. <img class="weui-tabbar__icon" src="icon.png" slot="icon"> 我
  25. </wv-tabbar-item>
  26. </wv-tabbar>
  27. </div>
  28. </template>
  29. <script>
  30. import {mapState, mapActions} from 'vuex';
  31. export default ({
  32. // 映射 vuex 上面的属性
  33. computed: mapState({
  34. recommend: state => state.news.recommend
  35. }),
  36. created() {
  37. // 获取推荐列表
  38. //this.getNewsRecommend();
  39. },
  40. methods: {
  41. // 映射 vuex 对象上的方法
  42. ...mapActions([
  43. 'getNewsRecommend'
  44. ])
  45. }
  46. });
  47. </script>