SubsetTabbar.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="tabbarView">
  3. <!-- @click="(ev) => BindClick(ev,index)" -->
  4. <view class="tabbarItem" v-for="(item,index) in tabbarData" :key="item.name" @click="linkTo(item.path)">
  5. <image :src="currIndex == index ? item.activeImage: item.imgUrl" mode=""></image>
  6. <text :class="{blueColor: currIndex == index}">{{ item.name }}</text>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. props: {
  13. BindClick: {
  14. type: Function,
  15. default: () => alert("暂时未绑定方法哦!")
  16. },
  17. currIndex: {
  18. type: [String, Number],
  19. default: 0
  20. }
  21. },
  22. data() {
  23. return {
  24. tabbarData: [{
  25. name: "查快递",
  26. path: "/pages_user/serve/kuai-di/index",
  27. imgUrl: require("../image/bangongbiaoqiantubiaoji_chakuaidi.png"),
  28. activeImage: require("../image/bangongbiaoqiantubiaoji_chakuaidi_active.png")
  29. },{
  30. name: "寄快递",
  31. path: "/pages_user/serve/kuai-di/DeliveryExpress",
  32. imgUrl: require("../image/jikuaidi.png"),
  33. activeImage: require("../image/jikuaidi_active.png")
  34. }
  35. // ,{
  36. // name: "我",
  37. // path: "/pages/index/convenient-services/kuai-di/MyExpress",
  38. // imgUrl: require("../image/wode.png"),
  39. // activeImage: require("../image/wode_active.png")
  40. // }
  41. ]
  42. };
  43. },
  44. methods: {
  45. linkTo(path) {
  46. uni.navigateTo({
  47. url: path
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .tabbarView {
  55. position: fixed;
  56. bottom: 0;
  57. left: 0;
  58. width: 100vw;
  59. height: 113rpx;
  60. background-color: white;
  61. display: flex;
  62. align-items: center;
  63. justify-content: space-around;
  64. .tabbarItem {
  65. width: 78rpx;
  66. height: 100rpx;
  67. display: flex;
  68. flex-direction: column;
  69. align-items: center;
  70. > image {
  71. width: 60rpx;
  72. height: 70rpx;
  73. }
  74. > text {
  75. margin-top: 8rpx;
  76. font-size: 26rpx;
  77. }
  78. .blueColor {
  79. color: #3881d8;
  80. }
  81. }
  82. }
  83. </style>