index.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <u-tabbar :value="currentTab" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" :activeColor="activeColor" :inactiveColor="inactiveColor"><u-tabbar-item v-for="(v, i) in tabList" :text="v.name" :icon="v.icon" @click="click1(i, v)"></u-tabbar-item></u-tabbar>
  3. </template>
  4. <script>
  5. export default {
  6. name: "tabbar",
  7. data() {
  8. return {
  9. list: [],
  10. tab: 0,
  11. };
  12. },
  13. props: {
  14. // currentTab: {
  15. // type: Number,
  16. // default: 0,
  17. // },
  18. inactiveColor: {
  19. type: String,
  20. default: "#3c3c3c",
  21. },
  22. activeColor: {
  23. type: String,
  24. default: "#1989fa",
  25. },
  26. },
  27. mounted() {},
  28. computed: {
  29. currentTab: function() {
  30. return this.$store.state.menu.current;
  31. },
  32. tabList: function() {
  33. return this.$store.state.menu.list;
  34. },
  35. },
  36. methods: {
  37. // getTabbar() {
  38. // console.log(this.$store.state.menu.list);
  39. // if (!this.$store.state.menu.list.length) {
  40. // this.$store.dispatch("menu/getMenus");
  41. // }
  42. // },
  43. click1(index, item) {
  44. this.$store.commit("menu/setCurrent", index);
  45. //this.$Router.replaceAll({ path: item.pagePath });
  46. uni.reLaunch({
  47. url: item.pagePath,
  48. });
  49. },
  50. },
  51. };
  52. </script>
  53. <style>
  54. .container {
  55. padding: 20px;
  56. font-size: 14px;
  57. line-height: 24px;
  58. }
  59. </style>