金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.1 KiB

  1. <template>
  2. <view>
  3. <lf-tabbar-box :value="currentTabBar"
  4. v-if="isShowTabBar"
  5. :close-animate-on-raisede="false">
  6. <lf-tabbar-item v-for="item in tabbars"
  7. :key="item.name"
  8. :name="item.name"
  9. :icon="item.icon"
  10. :dot="item.dot"
  11. :info="item.info"
  12. :path="item.path"
  13. :raisede="item.raisede"
  14. :style="{'width': 100 / tabbars.length +'%'}"
  15. @click="handleClick"
  16. icon-prefix="icon">
  17. {{ item.text }}
  18. </lf-tabbar-item>
  19. </lf-tabbar-box>
  20. </view>
  21. </template>
  22. <script>
  23. import lfTabbarBox from "./lf-tabbar-box.vue"
  24. import lfTabbarItem from "./lf-tabbar-item.vue"
  25. import { mapGetters } from "vuex";
  26. export default {
  27. name: 'lf-tabbar',
  28. components: {
  29. lfTabbarBox,
  30. lfTabbarItem
  31. },
  32. props: {
  33. type: {
  34. type: String, // 默认跳转方式redirect,可选switch
  35. default: 'redirect'
  36. }
  37. },
  38. computed: {
  39. ...mapGetters(['currentTabBar', 'tabbars', 'isShowTabBar'])
  40. },
  41. methods: {
  42. handleClick (options) {
  43. this.$store.commit('setCurrentTabBar', options.name);
  44. this.$url(options.path, {type: this.type});
  45. }
  46. }
  47. }
  48. </script>
  49. <style>
  50. </style>