Select.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. <template>
  2. <view>
  3. <u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="showPopup" length="auto"
  4. :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
  5. <view class="u-datetime-picker">
  6. <view class="u-picker-header">
  7. <view class="u-btn-picker u-btn-picker--tips" :style="{ color: cancelColor }"
  8. hover-class="u-opacity" :hover-stay-time="150" @tap="close()">{{cancelText}}</view>
  9. <view class="u-picker__title">{{ title }}</view>
  10. <view class="u-btn-picker u-btn-picker--primary"
  11. :style="{ color: moving ? cancelColor : confirmColor }" hover-class="u-opacity"
  12. :hover-stay-time="150" @tap.stop="getResult('confirm')">
  13. {{confirmText}}
  14. </view>
  15. </view>
  16. <view class="u-picker-body">
  17. <picker-view :value="valueArr" @change="change" class="u-picker-view" @pickstart="pickstart"
  18. @pickend="pickend" v-if="valueArr.length">
  19. <picker-view-column v-if="!reset && params.year">
  20. <view class="u-column-item" v-for="(item, index) in years" :key="index">
  21. {{ item }}
  22. <text class="u-text" v-if="showTimeTag">年</text>
  23. </view>
  24. </picker-view-column>
  25. <picker-view-column v-if="!reset && params.month">
  26. <view class="u-column-item" v-for="(item, index) in months" :key="index">
  27. {{ formatNumber(item) }}
  28. <text class="u-text" v-if="showTimeTag">月</text>
  29. </view>
  30. </picker-view-column>
  31. <picker-view-column v-if="!reset && params.day">
  32. <view class="u-column-item" v-for="(item, index) in days" :key="index">
  33. {{ formatNumber(item) }}
  34. <text class="u-text" v-if="showTimeTag">日</text>
  35. </view>
  36. </picker-view-column>
  37. <picker-view-column v-if="!reset && params.hour">
  38. <view class="u-column-item" v-for="(item, index) in hours" :key="index">
  39. {{ formatNumber(item) }}
  40. <text class="u-text" v-if="showTimeTag">时</text>
  41. </view>
  42. </picker-view-column>
  43. <picker-view-column v-if="!reset && params.minute">
  44. <view class="u-column-item" v-for="(item, index) in minutes" :key="index">
  45. {{ formatNumber(item) }}
  46. <text class="u-text" v-if="showTimeTag">分</text>
  47. </view>
  48. </picker-view-column>
  49. <picker-view-column v-if="!reset && params.second">
  50. <view class="u-column-item" v-for="(item, index) in seconds" :key="index">
  51. {{ formatNumber(item) }}
  52. <text class="u-text" v-if="showTimeTag">秒</text>
  53. </view>
  54. </picker-view-column>
  55. </picker-view>
  56. </view>
  57. </view>
  58. </u-popup>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. name: 'u-picker',
  64. props: {
  65. params: {
  66. type: Object,
  67. default () {
  68. return {
  69. year: true,
  70. month: true,
  71. day: true,
  72. hour: false,
  73. minute: false,
  74. second: false,
  75. timestamp: true,
  76. };
  77. }
  78. },
  79. // 当mode=selector或者mode=multiSelector时,提供的数组
  80. range: {
  81. type: Array,
  82. default () {
  83. return [];
  84. }
  85. },
  86. // 当mode=selector或者mode=multiSelector时,提供的默认选中的下标
  87. defaultSelector: {
  88. type: Array,
  89. default () {
  90. return [0];
  91. }
  92. },
  93. // 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
  94. rangeKey: {
  95. type: String,
  96. default: ''
  97. },
  98. // 模式选择,region-地区类型,time-时间类型,selector-单列模式,multiSelector-多列模式
  99. mode: {
  100. type: String,
  101. default: 'time'
  102. },
  103. // 年份开始时间
  104. startDate: {
  105. type: String,
  106. default: '1899-01-01 00:00:00'
  107. },
  108. // 年份结束时间
  109. endDate: {
  110. type: String,
  111. default: '2250-12-31 23:59:59'
  112. },
  113. // "取消"按钮的颜色
  114. cancelColor: {
  115. type: String,
  116. default: '#606266'
  117. },
  118. // "确定"按钮的颜色
  119. confirmColor: {
  120. type: String,
  121. default: '#2979ff'
  122. },
  123. // 默认显示的时间
  124. defaultTime: {
  125. type: String,
  126. default: ''
  127. },
  128. // 时间模式时,是否显示后面的年月日中文提示
  129. showTimeTag: {
  130. type: Boolean,
  131. default: true
  132. },
  133. safeAreaInsetBottom: {
  134. type: Boolean,
  135. default: false
  136. },
  137. // 是否允许通过点击遮罩关闭Picker
  138. maskCloseAble: {
  139. type: Boolean,
  140. default: false
  141. },
  142. // 通过双向绑定控制组件的弹出与收起
  143. modelValue: {
  144. type: Boolean,
  145. default: false
  146. },
  147. // 弹出的z-index值
  148. zIndex: {
  149. type: [String, Number],
  150. default: 0
  151. },
  152. // 顶部标题
  153. title: {
  154. type: String,
  155. default: ''
  156. },
  157. // 取消按钮的文字
  158. cancelText: {
  159. type: String,
  160. default: '取消'
  161. },
  162. // 确认按钮的文字
  163. confirmText: {
  164. type: String,
  165. default: '确认'
  166. },
  167. format: {
  168. type: String,
  169. default: 'yyyy-MM-dd HH:mm:ss'
  170. }
  171. },
  172. data() {
  173. return {
  174. years: [],
  175. months: [],
  176. days: [],
  177. hours: [],
  178. minutes: [],
  179. seconds: [],
  180. year: 0,
  181. month: 0,
  182. day: 0,
  183. hour: 0,
  184. minute: 0,
  185. second: 0,
  186. reset: false,
  187. valueArr: [],
  188. moving: false, // 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确
  189. showPopup: false
  190. };
  191. },
  192. mounted() {
  193. this.init();
  194. },
  195. computed: {
  196. propsChange() {
  197. // 引用这几个变量,是为了监听其变化
  198. return `${this.mode}-${this.defaultTime}-${this.startYear}-${this.endYear}-${this.defaultRegion}-${this.areaCode}`;
  199. },
  200. yearAndMonth() {
  201. return `${this.year}-${this.month}`;
  202. },
  203. uZIndex() {
  204. // 如果用户有传递z-index值,优先使用
  205. return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
  206. }
  207. },
  208. watch: {
  209. propsChange() {
  210. this.reset = true;
  211. setTimeout(() => this.init(), 10);
  212. },
  213. // watch监听月份的变化,实时变更日的天数,因为不同月份,天数不一样
  214. // 一个月可能有30,31天,甚至闰年2月的29天,平年2月28天
  215. yearAndMonth(val) {
  216. if (this.params.year) this.setDays();
  217. },
  218. // 微信和QQ小程序由于一些奇怪的原因(故同时对所有平台均初始化一遍),需要重新初始化才能显示正确的值
  219. modelValue: {
  220. handler(val) {
  221. if (val) {
  222. this.showPopup = val
  223. this.reset = true;
  224. setTimeout(() => this.init(), 10);
  225. }
  226. },
  227. immediate: true
  228. }
  229. },
  230. methods: {
  231. // 标识滑动开始,只有微信小程序才有这样的事件
  232. pickstart() {
  233. // #ifdef MP-WEIXIN
  234. this.moving = true;
  235. // #endif
  236. },
  237. // 标识滑动结束
  238. pickend() {
  239. // #ifdef MP-WEIXIN
  240. this.moving = false;
  241. // #endif
  242. },
  243. getIndex: function(arr, val) {
  244. let index = arr.indexOf(val);
  245. // 如果index为-1(即找不到index值),~(-1)=-(-1)-1=0,导致条件不成立
  246. return ~index ? index : 0;
  247. },
  248. //日期时间处理
  249. initTimeValue() {
  250. // 格式化时间,在IE浏览器(uni不存在此情况),无法识别日期间的"-"间隔符号
  251. let fdate = this.defaultTime.replace(/\-/g, '/');
  252. fdate = fdate && fdate.indexOf('/') == -1 ? `1899/01/01 ${fdate}` : fdate;
  253. let time = null;
  254. if (fdate) time = new Date(fdate);
  255. else time = new Date();
  256. // 获取年日月时分秒
  257. this.year = time.getFullYear();
  258. this.month = Number(time.getMonth()) + 1;
  259. this.day = time.getDate();
  260. this.hour = time.getHours();
  261. this.minute = time.getMinutes();
  262. this.second = time.getSeconds();
  263. },
  264. init() {
  265. this.valueArr = [];
  266. this.reset = false;
  267. this.initTimeValue();
  268. if (this.params.year) {
  269. this.valueArr.push(0);
  270. this.setYears();
  271. }
  272. if (this.params.month) {
  273. this.valueArr.push(0);
  274. this.setMonths();
  275. }
  276. if (this.params.day) {
  277. this.valueArr.push(0);
  278. this.setDays();
  279. }
  280. if (this.params.hour) {
  281. this.valueArr.push(0);
  282. this.setHours();
  283. }
  284. if (this.params.minute) {
  285. this.valueArr.push(0);
  286. this.setMinutes();
  287. }
  288. if (this.params.second) {
  289. this.valueArr.push(0);
  290. this.setSeconds();
  291. }
  292. },
  293. // 设置picker的某一列值
  294. setYears() {
  295. // 获取年份集合
  296. this.generateArray('year');
  297. if (this.years[0] > this.year) this.year = this.years[0]
  298. if (this.years[this.years.length - 1] < this.year) this.year = this.years[this.years.length - 1]
  299. // 设置this.valueArr某一项的值,是为了让picker预选中某一个值
  300. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.years, this.year));
  301. },
  302. setMonths() {
  303. this.generateArray('month');
  304. if (this.months[0] > this.month) this.month = this.months[0]
  305. if (this.months[this.months.length - 1] < this.month) this.month = this.months[this.months.length - 1]
  306. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.months, this.month));
  307. },
  308. setDays() {
  309. let totalDays = new Date(this.year, this.month, 0).getDate();
  310. this.generateArray('day');
  311. let index = 0;
  312. // 这里不能使用类似setMonths()中的this.valueArr.splice(this.valueArr.length - 1, xxx)做法
  313. // 因为this.month和this.year变化时,会触发watch中的this.setDays(),导致this.valueArr.length计算有误
  314. if (this.params.year && this.params.month) index = 2;
  315. else if (this.params.month) index = 1;
  316. else if (this.params.year) index = 1;
  317. else index = 0;
  318. // 当月份变化时,会导致日期的天数也会变化,如果原来选的天数大于变化后的天数,则重置为变化后的最大值
  319. // 比如原来选中3月31日,调整为2月后,日期变为最大29,这时如果day值继续为31显然不合理,于是将其置为29(picker-column从1开始)
  320. // if (this.day > this.days.length) this.day = this.days.length;
  321. if (this.days[0] > this.day) this.day = this.days[0]
  322. if (this.days[this.days.length - 1] < this.day) this.day = this.days[this.days.length - 1]
  323. this.valueArr.splice(index, 1, this.getIndex(this.days, this.day));
  324. },
  325. setHours() {
  326. this.generateArray('hour');
  327. if (this.hours[0] > this.hour) this.hour = this.hours[0]
  328. if (this.hours[this.hours.length - 1] < this.hour) this.hour = this.hours[this.hours.length - 1]
  329. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.hours, this.hour));
  330. },
  331. setMinutes() {
  332. this.generateArray('minute');
  333. if (this.minutes[0] > this.minute) this.minute = this.minutes[0]
  334. if (this.minutes[this.minutes.length - 1] < this.minute) this.minute = this.minutes[this.minutes.length -
  335. 1]
  336. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.minutes, this.minute));
  337. },
  338. setSeconds() {
  339. this.generateArray('second');
  340. if (this.seconds[0] > this.second) this.second = this.seconds[0]
  341. if (this.seconds[this.seconds.length - 1] < this.second) this.second = this.seconds[this.seconds.length -
  342. 1]
  343. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.seconds, this.second));
  344. },
  345. generateArray(type) {
  346. let startArr = this.startDate.split(" "); //开始日期时间
  347. let endArr = this.endDate.split(" "); //结束日期时间
  348. if (!this.month) this.month = this.months[this.months.length - 1]
  349. let totalDays = new Date(this.year, this.month, 0).getDate(); //当月天数
  350. //开始年月日时分秒
  351. let startDateArr = startArr[0] ? startArr[0].split("-") : []; //开始日期
  352. let startTimeArr = startArr[1] ? startArr[1].split(":") : []; //开始时间
  353. let startYear = Number(startDateArr[0]) || 1; //开始年
  354. let startMonth = Number(startDateArr[1]) || 1; //开始月
  355. let startDay = Number(startDateArr[2]) || 1; //开始天数
  356. let startHour = Number(startTimeArr[0]) || 0 //开始小时
  357. let startMinute = Number(startTimeArr[1]) || 0 //开始分钟
  358. let startSecond = Number(startTimeArr[2]) || 0 //开始秒
  359. //结束年月日时分秒
  360. let endDateArr = endArr[0] ? endArr[0].split("-") : [] //结束日期
  361. let endTimeArr = endArr[1] ? endArr[1].split(":") : []; //结束时间
  362. let endYear = Number(endDateArr[0]) || 12; //结束年
  363. let endMonth = Number(endDateArr[1]) || 12; //结束月
  364. let endDay = Number(endDateArr[2]) || totalDays; //结束天数
  365. let endHour = Number(endTimeArr[0]) || 0 //结束小时
  366. let endMinute = Number(endTimeArr[1]) || 0 //结束分钟
  367. let endSecond = Number(endTimeArr[2]) || 0 //结束秒
  368. // 转为数值格式,否则用户给end-year等传递字符串值时,下面的end+1会导致字符串拼接,而不是相加
  369. if (type == 'year') {
  370. startYear = Number(startYear);
  371. endYear = Number(endYear);
  372. endYear = endYear > startYear ? endYear : startYear;
  373. // 生成数组,获取其中的索引,并剪出来
  374. this.years = [...Array(endYear + 1).keys()].slice(startYear);
  375. this.generateArray('month')
  376. } else if (type == 'month') {
  377. let months = []
  378. if (startYear == Number(this.year)) {
  379. if (endYear == Number(this.year)) { // 起始年份,末尾年份一样时
  380. months = [...Array(endMonth + 1).keys()].slice(startMonth);
  381. } else {
  382. months = [...Array(12 + 1).keys()].slice(startMonth);
  383. }
  384. } else if (endYear == Number(this.year)) {
  385. months = [...Array(endMonth + 1).keys()].slice(1);
  386. } else {
  387. months = [...Array(12 + 1).keys()].slice(1);
  388. }
  389. this.months = months
  390. this.generateArray('day')
  391. } else if (type === 'day') {
  392. let days = []
  393. if (startYear == Number(this.year) && startMonth == Number(this.month)) {
  394. if (endYear == Number(this.year) && endMonth == Number(this
  395. .month)) {
  396. days = [...Array(endDay + 1).keys()].slice(startDay);
  397. } else {
  398. days = [...Array(totalDays + 1).keys()].slice(startDay);
  399. }
  400. } else if (endYear == Number(this.year) && endMonth == Number(this.month)) {
  401. days = [...Array(endDay + 1).keys()].slice(1);
  402. } else {
  403. days = [...Array(totalDays + 1).keys()].slice(1);
  404. }
  405. this.days = days
  406. this.generateArray('hour')
  407. } else if (type === 'hour') {
  408. let hours = []
  409. if (startYear == Number(this.year) && startMonth == Number(this.month) && startDay == Number(
  410. this.day)) {
  411. if (endYear == Number(this.year) && endMonth == Number(this.month) && endDay == Number(this
  412. .day)) {
  413. hours = [...Array(endHour + 1).keys()].slice(startHour);
  414. } else {
  415. hours = [...Array(23 + 1).keys()].slice(startHour);
  416. }
  417. } else if (endYear == Number(this.year) && endMonth == Number(this.month) && endDay == Number(
  418. this.day)) {
  419. hours = [...Array(endHour + 1).keys()].slice(0);
  420. } else {
  421. hours = [...Array(23 + 1).keys()].slice(0);
  422. }
  423. this.hours = hours
  424. this.generateArray('minute')
  425. } else if (type === 'minute') {
  426. let minutes = []
  427. if (startYear == Number(this.year) && startMonth == Number(this.month) && startDay == Number(
  428. this.day) && startHour == Number(this.hour)) {
  429. if (endYear == Number(this.year) && endMonth == Number(this.month) && endDay == Number(this.day) &&
  430. endHour == Number(this.hour)) {
  431. minutes = [...Array(endMinute + 1).keys()].slice(startMinute);
  432. } else {
  433. minutes = [...Array(59 + 1).keys()].slice(startMinute);
  434. }
  435. } else if (endYear == Number(this.year) && endMonth == Number(this.month) && endDay == Number(
  436. this.day) && endHour == Number(this.hour)) {
  437. minutes = [...Array(endMinute + 1).keys()].slice(0);
  438. } else {
  439. minutes = [...Array(59 + 1).keys()].slice(0);
  440. }
  441. this.minutes = minutes
  442. this.generateArray('seconds')
  443. } else {
  444. let seconds = []
  445. if (startYear == Number(this.year) && startMonth == Number(this.month) && startDay == Number(
  446. this.day) && startHour == Number(this.hour) && startMinute ==
  447. Number(this.minute)) {
  448. if (endYear == Number(this.year) && endMonth == Number(this.month) && endDay == Number(this
  449. .day) && endHour == Number(this.hour) && endMinute ==
  450. Number(this.minute)) {
  451. seconds = [...Array(endSecond + 1).keys()].slice(startSecond);
  452. } else {
  453. seconds = [...Array(59 + 1).keys()].slice(startSecond);
  454. }
  455. } else if (endYear == Number(this.year) && endMonth == Number(this.month) && endDay == Number(this
  456. .day) && endHour == Number(this.hour) && endMinute == Number(
  457. this.minute)) {
  458. seconds = [...Array(endSecond + 1).keys()].slice(0);
  459. } else {
  460. seconds = [...Array(59 + 1).keys()].slice(0);
  461. }
  462. this.seconds = seconds
  463. }
  464. },
  465. close() {
  466. this.$emit('close')
  467. },
  468. // 用户更改picker的列选项
  469. change(e) {
  470. this.valueArr = e.detail.value;
  471. let i = 0;
  472. // 这里使用i++,是因为this.valueArr数组的长度是不确定长度的,它根据this.params的值来配置长度
  473. // 进入if规则,i会加1,保证了能获取准确的值
  474. if (this.params.year) {
  475. this.year = this.years[this.valueArr[i++]];
  476. this.generateArray('year')
  477. }
  478. if (this.params.month) {
  479. this.month = this.months[this.valueArr[i++]];
  480. this.generateArray('month')
  481. }
  482. if (this.params.day) {
  483. const index = this.valueArr[i++]
  484. this.day = this.days[index] ? this.days[index] : this.days[0];
  485. this.generateArray('day')
  486. }
  487. if (this.params.hour) {
  488. this.hour = this.hours[this.valueArr[i++]];
  489. this.generateArray('hour')
  490. }
  491. if (this.params.minute) {
  492. this.minute = this.minutes[this.valueArr[i++]];
  493. this.generateArray('minute')
  494. }
  495. if (this.params.second) {
  496. this.second = this.seconds[this.valueArr[i++]];
  497. this.generateArray('second')
  498. }
  499. },
  500. // 用户点击确定按钮
  501. getResult() {
  502. // #ifdef MP-WEIXIN
  503. if (this.moving) return;
  504. // #endif
  505. let result = {};
  506. // 只返回用户在this.params中配置了为true的字段
  507. if (this.params.year) result.year = this.formatNumber(this.year || 0);
  508. if (this.params.month) result.month = this.formatNumber(this.month || 0);
  509. if (this.params.day) result.day = this.formatNumber(this.day || 0);
  510. if (this.params.hour) result.hour = this.formatNumber(this.hour || 0);
  511. if (this.params.minute) result.minute = this.formatNumber(this.minute || 0);
  512. if (this.params.second) result.second = this.formatNumber(this.second || 0);
  513. if (this.params.timestamp) result.timestamp = this.getTimestamp();
  514. this.$emit('confirm', result);
  515. this.close();
  516. },
  517. // 小于10前面补0,用于月份,日期,时分秒等
  518. formatNumber(num) {
  519. return +num < 10 ? '0' + num : String(num);
  520. },
  521. // 获取时间戳
  522. getTimestamp() {
  523. let format = this.jnpf.handelFormat(this.format)
  524. let timeType = format === 'yyyy' ? '/01/01 00:00:00' : format === 'yyyy-MM' ? '/01 00:00:00' :
  525. format === 'yyyy-MM-dd' ?
  526. ' 00:00:00' : ''
  527. // yyyy-mm-dd为安卓写法,不支持iOS,需要使用"/"分隔,才能二者兼容
  528. let time = "";
  529. if (this.params.year && !this.params.month && !this.params.day && !this.params.hour && !this.params
  530. .minute && !this.params.second) {
  531. time = this.year + timeType
  532. } else if (this.params.year && this.params.month && !this.params.day && !this.params.hour && !this.params
  533. .minute && !this.params.second) {
  534. time = this.year + '/' + this.month + timeType
  535. } else if (this.params.year && this.params.month && this.params.day && !this.params.hour && !this.params
  536. .minute && !this.params.second) {
  537. time = this.year + '/' + this.month + '/' + this.day + timeType
  538. } else if (this.params.year && this.params.month && this.params.day && this.params.hour && !this.params
  539. .minute && !this.params.second) {
  540. time = this.year + '/' + this.month + '/' + this.day + " " + this.hour + timeType
  541. } else if (this.params.year && this.params.month && this.params.day && this.params.hour && this.params
  542. .minute && !this.params.second) {
  543. time = this.year + '/' + this.month + '/' + this.day + " " + this.hour + ":" + this.minute + timeType
  544. } else {
  545. time = this.year + '/' + this.month + '/' + this.day + " " + this.hour + ":" + this.minute + ":" + this
  546. .second + timeType
  547. }
  548. return new Date(time).getTime();
  549. }
  550. }
  551. };
  552. </script>
  553. <style lang="scss" scoped>
  554. .u-datetime-picker {
  555. position: relative;
  556. z-index: 999;
  557. }
  558. .u-picker-view {
  559. height: 100%;
  560. box-sizing: border-box;
  561. }
  562. .u-picker-header {
  563. width: 100%;
  564. height: 90rpx;
  565. padding: 0 40rpx;
  566. display: flex;
  567. justify-content: space-between;
  568. align-items: center;
  569. box-sizing: border-box;
  570. font-size: 30rpx;
  571. background: #fff;
  572. position: relative;
  573. }
  574. .u-picker-header::after {
  575. content: '';
  576. position: absolute;
  577. border-bottom: 1rpx solid #eaeef1;
  578. -webkit-transform: scaleY(0.5);
  579. transform: scaleY(0.5);
  580. bottom: 0;
  581. right: 0;
  582. left: 0;
  583. }
  584. .u-picker__title {
  585. color: $u-content-color;
  586. }
  587. .u-picker-body {
  588. width: 100%;
  589. height: 500rpx;
  590. overflow: hidden;
  591. background-color: #fff;
  592. }
  593. .u-column-item {
  594. display: flex;
  595. align-items: center;
  596. justify-content: center;
  597. font-size: 32rpx;
  598. color: $u-main-color;
  599. padding: 0 8rpx;
  600. }
  601. .u-text {
  602. font-size: 24rpx;
  603. padding-left: 8rpx;
  604. }
  605. .u-btn-picker {
  606. padding: 16rpx;
  607. box-sizing: border-box;
  608. text-align: center;
  609. text-decoration: none;
  610. }
  611. .u-opacity {
  612. opacity: 0.5;
  613. }
  614. .u-btn-picker--primary {
  615. color: $u-type-primary;
  616. }
  617. .u-btn-picker--tips {
  618. color: $u-tips-color;
  619. }
  620. </style>