nav.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="box">
  3. <view class="header-box">
  4. <view class="top-box">
  5. <view class="box-right"><wyb-drop-down :zIndex='1' class="han-box" ref="dropDown" :options="options" @select="onItemSelect"></wyb-drop-down></view>
  6. </view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import wybDropDown from '@/components/wyb-drop-down/wyb-drop-down.vue';
  12. // import { goodslist,allist,aboutlist, fllist } from '../../api/api.js';
  13. export default {
  14. components: {
  15. wybDropDown
  16. },
  17. data() {
  18. return {
  19. show: false,
  20. options: [
  21. {
  22. header: 'Language',
  23. contents: ['中文', 'english']
  24. }
  25. ],
  26. langlist: ['zh_cn', 'en'],
  27. // 弹窗分类样式
  28. itemStyle: {
  29. fontSize: '36rpx',
  30. fontWeight: 'bold'
  31. },
  32. // 弹窗标题样式
  33. titleStyle: {
  34. 'font-size': '40rpx'
  35. },
  36. //弹窗当前idnex
  37. swIndex: 0,
  38. checkedIndex: 0, //设置当前选中的分类对象
  39. popList: [
  40. {
  41. type: 'product',
  42. title: '公司产品',
  43. list: [], //保存商品列表
  44. loding: false, //判断是否加载中
  45. more: 'loadmore' //判断是否还可以加载数据
  46. },
  47. {
  48. type: 'cases',
  49. title: '方案案例',
  50. list: [], //保存商品列表
  51. loding: false, //判断是否加载中
  52. more: 'loadmore' //判断是否还可以加载数据
  53. },
  54. {
  55. type: 'about',
  56. title: '关于我们',
  57. list: [], //保存商品列表
  58. loding: false, //判断是否加载中
  59. more: 'loadmore' //判断是否还可以加载数据
  60. }
  61. ],
  62. // 自定义加载文本
  63. loadText: {
  64. loadmore: 'loading...',
  65. loading: 'loading...',
  66. nomore: 'ready'
  67. }
  68. };
  69. },
  70. created() {
  71. // this.init();
  72. const lang = uni.getStorageSync('lang')||0;
  73. this.$store.commit('changelang', this.langlist[lang]);
  74. },
  75. methods: {
  76. // 下拉选择语言分类
  77. onItemSelect(e) {
  78. const lang = this.langlist[e.contentIndex];
  79. uni.setStorageSync('lang',e.contentIndex)
  80. this.$store.commit('changelang', lang);
  81. this.$i18n.locale = lang;
  82. // 保存当前选中的对象
  83. this.$emit('changeSelect', e);
  84. this.$refs.dropDown.close();
  85. console.log(lang);
  86. },
  87. }
  88. };
  89. </script>
  90. <style lang="scss">
  91. .alertSw {
  92. height: 100vh;
  93. .item {
  94. padding-top: 100rpx;
  95. }
  96. }
  97. /deep/ .collapseItemBox{
  98. .title{
  99. padding: 30rpx;
  100. font-size: 32rpx;
  101. font-weight: bold;
  102. color: #101010;
  103. }
  104. }
  105. .margin-t-40 {
  106. margin-top: 40rpx;
  107. }
  108. .alertColl,
  109. .pop-box,
  110. .header-box {
  111. padding: 0 30rpx;
  112. }
  113. .navtoIndex {
  114. font-size: 41rpx;
  115. font-weight: bold;
  116. margin-bottom: 20rpx;
  117. padding-left: 30rpx;
  118. }
  119. .pop-box {
  120. position: relative;
  121. width: 700rpx;
  122. padding-right: 15rpx;
  123. .box-right {
  124. position: absolute;
  125. top: 0;
  126. left: 0;
  127. width: 100%;
  128. text-align: right;
  129. // margin-bottom: 20rpx;
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. z-index: 999;
  134. .item {
  135. padding: 30rpx;
  136. }
  137. }
  138. .collapse-item {
  139. font-weight: 500;
  140. .item-box {
  141. font-size: 28rpx;
  142. color: #101010;
  143. // margin-bottom: 15rpx;
  144. line-height: 50rpx;
  145. }
  146. }
  147. }
  148. .header-box {
  149. width: 750rpx;
  150. height: 100rpx;
  151. background: #fefefe;
  152. display: flex;
  153. align-items: center;
  154. padding: 0 30rpx;
  155. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  156. position: fixed;
  157. top: 0;
  158. left: 0;
  159. z-index: 1000;
  160. .box-center {
  161. flex: 1;
  162. text-align: center;
  163. margin-left: 180rpx;
  164. font-size: 34rpx;
  165. font-weight: bold;
  166. color: #101010;
  167. }
  168. .box-right {
  169. width: 180rpx;
  170. text-align: right;
  171. position: relative;
  172. height: calc(100% - 1px);
  173. overflow: hidden;
  174. /deep/ .wyb-drop-down-header {
  175. position: absolute;
  176. top: 0;
  177. left: 0;
  178. width: 100%;
  179. }
  180. /deep/ .wyb-drop-down-content {
  181. top: 88rpx;
  182. }
  183. }
  184. .top-box {
  185. display: flex;
  186. justify-content: space-between;
  187. align-items: center;
  188. width: 100%;
  189. height: 100rpx;
  190. z-index: 99999;
  191. .top-left {
  192. height: 100%;
  193. display: flex;
  194. align-items: center;
  195. flex-grow: 1;
  196. background-color: #e3e3e3;
  197. .logo-img {
  198. width: 314rpx;
  199. height: 43rpx;
  200. }
  201. }
  202. .top-right,
  203. .top-left {
  204. z-index: 99999;
  205. background-color: #ffffff;
  206. }
  207. .top-right {
  208. padding-left: 20rpx;
  209. height: 100%;
  210. display: flex;
  211. align-items: center;
  212. }
  213. }
  214. }
  215. </style>