tabbar.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <!-- <view class="status_bar" :style="{ height: height + 30 + 'px' }"></view> -->
  4. <uni-nav-bar
  5. left-icon="settings "
  6. backgroundColor="#ff0505"
  7. color="rgb(255, 255, 255)"
  8. style="font-size: 16px"
  9. right-icon="person-filled"
  10. @clickRight="backRight"
  11. :title="text" />
  12. <!-- @clickLeft="backLeft" -->
  13. <view v-for="(item, index) in pageData" :key="index">
  14. <component :is="item.component" v-if="PageCur == index"></component>
  15. </view>
  16. <view class="tabber bg-white padding-tb-xs flex text-center text-sm">
  17. <view
  18. class="tabber-item flex-sub"
  19. v-for="(item, index) in pageData"
  20. :key="index"
  21. @click="NavChange(index)">
  22. <image
  23. class="tabber-image"
  24. :src="
  25. PageCur == index ? item.selectedIconPath : item.iconPath
  26. "></image>
  27. <view :class="PageCur == index ? 'text-black' : 'text-gray'">
  28. {{ item.text }}
  29. </view>
  30. </view>
  31. </view>
  32. <uni-popup ref="inputDialog" type="dialog">
  33. <uni-popup-dialog
  34. ref="inputClose"
  35. title="切换车间"
  36. value="对话框预置提示内容!"
  37. placeholder="请输入内容"
  38. @confirm="dialogInputConfirm">
  39. <u-radio-group
  40. placement="column"
  41. :borderBottom="true"
  42. v-model="value"
  43. iconPlacement="right">
  44. <u-radio
  45. :customStyle="{ marginBottom: '8px' }"
  46. v-for="(item, index) in radiolist1"
  47. :key="index"
  48. :label="item.name"
  49. :name="item.name"
  50. @change="radioChange"></u-radio>
  51. </u-radio-group>
  52. </uni-popup-dialog>
  53. </uni-popup>
  54. </view>
  55. </template>
  56. <script>
  57. import index from "../index.vue";
  58. import search from "../search/search.vue";
  59. import news from "../news/news.vue";
  60. import me from "../me/me.vue";
  61. export default {
  62. components: {
  63. index,
  64. search,
  65. news,
  66. me,
  67. },
  68. data() {
  69. return {
  70. text: "入库管理",
  71. value: "测试仓库",
  72. height: "",
  73. radiolist1: [
  74. {
  75. name: "测试仓库",
  76. disabled: false,
  77. },
  78. ],
  79. pageData: [
  80. {
  81. pagePath: "pages/index/index",
  82. iconPath: "/static/tabBar/index.png",
  83. selectedIconPath: "/static/tabBar/index_cur.png",
  84. text: "入库管理",
  85. component: "index",
  86. },
  87. {
  88. pagePath: "pages/search/search",
  89. iconPath: "/static/tabBar/shop.png",
  90. selectedIconPath: "/static/tabBar/shop_cur.png",
  91. text: "出库管理",
  92. component: "search",
  93. },
  94. {
  95. pagePath: "pages/news/news",
  96. iconPath: "/static/tabBar/order.png",
  97. selectedIconPath: "/static/tabBar/order_cur.png",
  98. text: "仓内管理",
  99. component: "news",
  100. },
  101. {
  102. pagePath: "pages/me/me",
  103. iconPath: "/static/tabBar/me.png",
  104. selectedIconPath: "/static/tabBar/me_cur.png",
  105. text: "日常管理",
  106. component: "me",
  107. },
  108. ],
  109. PageCur: 0,
  110. };
  111. },
  112. onLoad() {
  113. var _this = this;
  114. // uni.hideBackButton();
  115. // 获取手机状态栏高度
  116. uni.getSystemInfo({
  117. success: function (data) {
  118. // 将其赋值给this
  119. _this.height = data.statusBarHeight;
  120. },
  121. });
  122. },
  123. methods: {
  124. NavChange: function (e) {
  125. this.PageCur = e;
  126. this.text = this.pageData[e].text;
  127. console.log("e", e);
  128. },
  129. backLeft() {
  130. this.$refs.inputDialog.open();
  131. },
  132. dialogInputConfirm(e) {
  133. console.log("e", e);
  134. },
  135. backRight() {
  136. uni.navigateTo({
  137. url: "/pages/person",
  138. });
  139. },
  140. },
  141. };
  142. </script>
  143. <style scoped>
  144. .status_bar {
  145. /* height: var(--status-bar-height); */
  146. /* background-color: #ff0505; */
  147. position: fixed;
  148. z-index: 1;
  149. width: 100%;
  150. top: 0;
  151. left: 0;
  152. }
  153. >>> .uni-ellipsis-1 {
  154. overflow: hidden;
  155. white-space: nowrap;
  156. font-size: 17px !important;
  157. font-weight: 500;
  158. text-overflow: ellipsis;
  159. }
  160. </style>
  161. <style scoped lang="scss">
  162. .tabber {
  163. width: 100%;
  164. position: fixed;
  165. bottom: 0;
  166. left: 0;
  167. .tabber-image {
  168. width: 20px;
  169. height: 20px;
  170. }
  171. }
  172. </style>