6969 * @event {Function} confirm 点击确定按钮,返回当前选择的值
7070 * @example < u- select v- model= " show" : list= " list" >< / u- select>
7171 */
72-
72+
7373export default {
7474 props: {
7575 // 列数据
@@ -155,7 +155,7 @@ export default {
155155 // 每次队列发生变化时,保存选择的结果
156156 selectValue: [],
157157 // 上一次列变化时的index
158- lastSelectIndex: [],
158+ lastSelectIndex: [],
159159 // 列数
160160 columnNum: 0 ,
161161 // 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确
@@ -262,39 +262,39 @@ export default {
262262 // 列选项
263263 columnChange (e ) {
264264 let index = null ;
265- let cloumnIndex = e .detail .value ;
265+ let columnIndex = e .detail .value ;
266266 // 由于后面是需要push进数组的,所以需要先清空数组
267267 this .selectValue = [];
268268 if (this .mode == ' mutil-column-auto' ) {
269269 // 对比前后两个数组,寻找变更的是哪一列,如果某一个元素不同,即可判定该列发生了变化
270270 this .lastSelectIndex .map ((val , idx ) => {
271- if (val != cloumnIndex [idx]) index = idx;
271+ if (val != columnIndex [idx]) index = idx;
272272 });
273- this .defaultSelector = cloumnIndex ;
273+ this .defaultSelector = columnIndex ;
274274 for (let i = index + 1 ; i < this .columnNum ; i++ ) {
275275 // 当前变化列的下一列的数据,需要获取上一列的数据,同时需要指定是上一列的第几个的children,再往后的
276276 // 默认是队列的第一个为默认选项
277- this .columnData [i] = this .columnData [i - 1 ][i - 1 == index ? cloumnIndex [index] : 0 ][this .childName ];
277+ this .columnData [i] = this .columnData [i - 1 ][i - 1 == index ? columnIndex [index] : 0 ][this .childName ];
278278 // 改变的列之后的所有列,默认选中第一个
279279 this .defaultSelector [i] = 0 ;
280280 }
281281 // 在历遍的过程中,可能由于上一步修改this.columnData,导致产生连锁反应,程序触发columnChange,会有多次调用
282282 // 只有在最后一次数据稳定后的结果是正确的,此前的历遍中,可能会产生undefined,故需要判断
283- cloumnIndex .map ((item , index ) => {
284- let data = this .columnData [index][cloumnIndex [index]];
283+ columnIndex .map ((item , index ) => {
284+ let data = this .columnData [index][columnIndex [index]];
285285 let tmp = {
286286 value: data ? data[this .valueName ] : null ,
287287 label: data ? data[this .labelName ] : null ,
288288 };
289289 // 判断是否有需要额外携带的参数
290290 if (data && data .extra ) tmp .extra = data .extra ;
291291 this .selectValue .push (tmp);
292-
292+
293293 })
294294 // 保存这一次的结果,用于下次列发生变化时作比较
295- this .lastSelectIndex = cloumnIndex ;
295+ this .lastSelectIndex = columnIndex ;
296296 } else if (this .mode == ' single-column' ) {
297- let data = this .columnData [0 ][cloumnIndex [0 ]];
297+ let data = this .columnData [0 ][columnIndex [0 ]];
298298 // 初始默认选中值
299299 let tmp = {
300300 value: data ? data[this .valueName ] : null ,
@@ -305,8 +305,8 @@ export default {
305305 this .selectValue .push (tmp);
306306 } else if (this .mode == ' mutil-column' ) {
307307 // 初始默认选中值
308- cloumnIndex .map ((item , index ) => {
309- let data = this .columnData [index][cloumnIndex [index]];
308+ columnIndex .map ((item , index ) => {
309+ let data = this .columnData [index][columnIndex [index]];
310310 // 初始默认选中值
311311 let tmp = {
312312 value: data ? data[this .valueName ] : null ,
@@ -340,38 +340,38 @@ export default {
340340@import " ../../libs/css/style.components.scss" ;
341341
342342.u-select {
343-
343+
344344 & __action {
345345 position : relative ;
346346 line-height : $u-form-item-height ;
347347 height : $u-form-item-height ;
348-
348+
349349 & __icon {
350350 position : absolute ;
351351 right : 20 rpx;
352352 top : 50% ;
353353 transition : transform .4s ;
354354 transform : translateY (-50% );
355355 z-index : 1 ;
356-
356+
357357 & --reverse {
358358 transform : rotate (-180deg ) translateY (50% );
359359 }
360360 }
361361 }
362-
362+
363363 & __hader {
364364 & __title {
365365 color : $u-content-color ;
366366 }
367367 }
368-
368+
369369 & --border {
370370 border-radius : 6 rpx;
371371 border-radius : 4px ;
372372 border : 1px solid $u-form-item-border-color ;
373373 }
374-
374+
375375 & __header {
376376 display : flex ;
377377 align-items : center ;
0 commit comments