tabbar.vue 3.9 KB

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