footer-tabbar.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="cu-bar tabbar bg-white zaiui-footer-fixed">
  3. <view class="cu-bar tabbar bg-white zaiui-footer-fixed">
  4. <view class="action" :class="TabID == 0?'text-red':'text-black'" @tap="tabTap(0)">
  5. <view :class="TabID == 0?'cuIcon-homefill':'cuIcon-home'"></view>
  6. <text>商品</text>
  7. </view>
  8. <view class="action" :class="TabID == 1?'text-red':'text-black'" @tap="tabTap(1)">
  9. <view :class="TabID == 1?'cuIcon-discoverfill':'cuIcon-discover'"></view>
  10. <text>资源</text>
  11. </view>
  12. <!-- <view class="action add-action" @tap="tabTap(2)">
  13. <button class="cu-btn cuIcon-add bg-red shadow"></button>
  14. <text>卖二手</text>
  15. </view>
  16. <view class="action" :class="TabID == 3?'text-red':'text-black'" @tap="tabTap(3)">
  17. <view :class="TabID == 3?'cuIcon-messagefill':'cuIcon-message'">
  18. <view class="cu-tag badge" v-if="MsgDot"></view>
  19. </view>
  20. <text>消息</text>
  21. </view> -->
  22. <view class="action" :class="TabID == 4?'text-red':'text-black'" @tap="tabTap(4)">
  23. <view :class="TabID == 4?'cuIcon-peoplefill':'cuIcon-people'"></view>
  24. <text>我的</text>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name: 'footer-tabbar',
  32. data() {
  33. return {
  34. TabID: 0, MsgDot: false,
  35. };
  36. },
  37. props: {
  38. tabID: {
  39. type: [String,Number],
  40. default: 0
  41. },
  42. msgDot: {
  43. type: Boolean,
  44. default: false
  45. },
  46. },
  47. created() {
  48. this.TabID = this.tabID;
  49. this.MsgDot = this.msgDot;
  50. this.loadInfo()
  51. },
  52. watch: {
  53. tabID() {
  54. if(this.tabID != 2) {
  55. this.TabID = this.tabID;
  56. }
  57. },
  58. msgDot() {
  59. this.MsgDot = this.msgDot;
  60. }
  61. },
  62. methods: {
  63. loadInfo() {
  64. console.log('infffff')
  65. },
  66. tabTap(index) {
  67. if(index != this.TabID) {
  68. this.$emit('tabTap', index);
  69. }
  70. }
  71. }
  72. }
  73. </script>
  74. <style>
  75. </style>