File tree Expand file tree Collapse file tree 8 files changed +32
-26
lines changed
pages/components/form/pages/checkbox Expand file tree Collapse file tree 8 files changed +32
-26
lines changed Original file line number Diff line number Diff line change @@ -21,20 +21,20 @@ Component({
21
21
value : 'column' , //column row
22
22
} ,
23
23
// 最多选中值
24
- max : {
24
+ maxSelected : {
25
25
type : [ Number , null ] ,
26
26
value : null
27
27
} ,
28
- min : {
28
+ minSelected : {
29
29
type : [ Number , null ] ,
30
30
value : null
31
31
}
32
32
} ,
33
33
data : {
34
34
} ,
35
35
attached ( ) {
36
- let { min , max } = this . properties ;
37
- this . checkMax ( min , max ) ;
36
+ let { minSelected , maxSelected } = this . properties ;
37
+ this . checkMax ( minSelected , maxSelected ) ;
38
38
} ,
39
39
methods : {
40
40
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ Component({
74
74
const parent = this . getRelationNodes ( '../checkbox-group/index' ) [ 0 ] ;
75
75
76
76
if ( this . properties . checked ) {
77
- if ( this . isOverflow ( 'min ' ) ) return ;
77
+ if ( this . isOverflow ( 'minSelected ' ) ) return ;
78
78
} else {
79
- if ( this . isOverflow ( 'max ' ) ) return ;
79
+ if ( this . isOverflow ( 'maxSelected ' ) ) return ;
80
80
}
81
81
82
82
const item = {
@@ -95,12 +95,14 @@ Component({
95
95
*/
96
96
isOverflow ( type ) {
97
97
const parent = this . getRelationNodes ( '../checkbox-group/index' ) [ 0 ] ;
98
+
98
99
const limit = parent . properties [ type ] ;
99
100
if ( ! limit ) return false ;
100
101
const selectedLength = Object . values ( parent . _selected ) . length ;
101
- let isOverflow = type === 'min ' ? selectedLength <= limit : selectedLength >= limit ;
102
+ let isOverflow = type === 'minSelected ' ? selectedLength <= limit : selectedLength >= limit ;
102
103
if ( isOverflow ) {
103
- parent . onEmitOverflowHandle && parent . onEmitOverflowHandle ( { key : this . properties . key , number : limit , type : `overflow_${ type } ` } ) ;
104
+ let backType = type === 'minSelected' ? 'min_selected' : 'max_selected' ;
105
+ parent . onEmitOverflowHandle && parent . onEmitOverflowHandle ( { key : this . properties . key , limitNumber : limit , type : `overflow_${ backType } ` } ) ;
104
106
}
105
107
return isOverflow ;
106
108
}
Original file line number Diff line number Diff line change @@ -21,20 +21,20 @@ Component({
21
21
value : 'column' , //column row
22
22
} ,
23
23
// 最多选中值
24
- max : {
24
+ maxSelected : {
25
25
type : [ Number , null ] ,
26
26
value : null
27
27
} ,
28
- min : {
28
+ minSelected : {
29
29
type : [ Number , null ] ,
30
30
value : null
31
31
}
32
32
} ,
33
33
data : {
34
34
} ,
35
35
attached ( ) {
36
- let { min , max } = this . properties ;
37
- this . checkMax ( min , max ) ;
36
+ let { minSelected , maxSelected } = this . properties ;
37
+ this . checkMax ( minSelected , maxSelected ) ;
38
38
} ,
39
39
methods : {
40
40
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ Component({
74
74
const parent = this . getRelationNodes ( '../checkbox-group/index' ) [ 0 ] ;
75
75
76
76
if ( this . properties . checked ) {
77
- if ( this . isOverflow ( 'min ' ) ) return ;
77
+ if ( this . isOverflow ( 'minSelected ' ) ) return ;
78
78
} else {
79
- if ( this . isOverflow ( 'max ' ) ) return ;
79
+ if ( this . isOverflow ( 'maxSelected ' ) ) return ;
80
80
}
81
81
82
82
const item = {
@@ -95,12 +95,14 @@ Component({
95
95
*/
96
96
isOverflow ( type ) {
97
97
const parent = this . getRelationNodes ( '../checkbox-group/index' ) [ 0 ] ;
98
+
98
99
const limit = parent . properties [ type ] ;
99
100
if ( ! limit ) return false ;
100
101
const selectedLength = Object . values ( parent . _selected ) . length ;
101
- let isOverflow = type === 'min ' ? selectedLength <= limit : selectedLength >= limit ;
102
+ let isOverflow = type === 'minSelected ' ? selectedLength <= limit : selectedLength >= limit ;
102
103
if ( isOverflow ) {
103
- parent . onEmitOverflowHandle && parent . onEmitOverflowHandle ( { key : this . properties . key , number : limit , type : `overflow_${ type } ` } ) ;
104
+ let backType = type === 'minSelected' ? 'min_selected' : 'max_selected' ;
105
+ parent . onEmitOverflowHandle && parent . onEmitOverflowHandle ( { key : this . properties . key , limitNumber : limit , type : `overflow_${ backType } ` } ) ;
104
106
}
105
107
return isOverflow ;
106
108
}
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ Page({
204
204
} ,
205
205
206
206
tipOverflow ( data ) {
207
- let title = data . detail . type === 'overflow_max ' ? `最多选择${ data . detail . number } 个` : `至少选择${ data . detail . number } 个` ;
207
+ let title = data . detail . type === 'overflow_max_selected ' ? `最多选择${ data . detail . limitNumber } 个` : `至少选择${ data . detail . limitNumber } 个` ;
208
208
wx . showToast ( {
209
209
title : title ,
210
210
icon : 'none' ,
Original file line number Diff line number Diff line change 209
209
>
210
210
<view class='buttun-wrapper'>
211
211
<view class='title'>10. 下面哪些演员获得影帝称号?</view>
212
- <l-checkbox-group bind:linchange="change" min="2" max="3" bind:linout="tipOverflow" data-index="10">
212
+ <l-checkbox-group bind:linchange="change" min-selected ="2" max-selected ="3" bind:linout="tipOverflow" data-index="10">
213
213
<l-checkbox
214
214
l-class="l-checkbox-color"
215
215
wx:for="{{items10}}"
Original file line number Diff line number Diff line change @@ -21,20 +21,20 @@ Component({
21
21
value : 'column' , //column row
22
22
} ,
23
23
// 最多选中值
24
- max : {
24
+ maxSelected : {
25
25
type : [ Number , null ] ,
26
26
value : null
27
27
} ,
28
- min : {
28
+ minSelected : {
29
29
type : [ Number , null ] ,
30
30
value : null
31
31
}
32
32
} ,
33
33
data : {
34
34
} ,
35
35
attached ( ) {
36
- let { min , max } = this . properties ;
37
- this . checkMax ( min , max ) ;
36
+ let { minSelected , maxSelected } = this . properties ;
37
+ this . checkMax ( minSelected , maxSelected ) ;
38
38
} ,
39
39
methods : {
40
40
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ Component({
74
74
const parent = this . getRelationNodes ( '../checkbox-group/index' ) [ 0 ] ;
75
75
76
76
if ( this . properties . checked ) {
77
- if ( this . isOverflow ( 'min ' ) ) return ;
77
+ if ( this . isOverflow ( 'minSelected ' ) ) return ;
78
78
} else {
79
- if ( this . isOverflow ( 'max ' ) ) return ;
79
+ if ( this . isOverflow ( 'maxSelected ' ) ) return ;
80
80
}
81
81
82
82
const item = {
@@ -95,12 +95,14 @@ Component({
95
95
*/
96
96
isOverflow ( type ) {
97
97
const parent = this . getRelationNodes ( '../checkbox-group/index' ) [ 0 ] ;
98
+
98
99
const limit = parent . properties [ type ] ;
99
100
if ( ! limit ) return false ;
100
101
const selectedLength = Object . values ( parent . _selected ) . length ;
101
- let isOverflow = type === 'min ' ? selectedLength <= limit : selectedLength >= limit ;
102
+ let isOverflow = type === 'minSelected ' ? selectedLength <= limit : selectedLength >= limit ;
102
103
if ( isOverflow ) {
103
- parent . onEmitOverflowHandle && parent . onEmitOverflowHandle ( { key : this . properties . key , number : limit , type : `overflow_${ type } ` } ) ;
104
+ let backType = type === 'minSelected' ? 'min_selected' : 'max_selected' ;
105
+ parent . onEmitOverflowHandle && parent . onEmitOverflowHandle ( { key : this . properties . key , limitNumber : limit , type : `overflow_${ backType } ` } ) ;
104
106
}
105
107
return isOverflow ;
106
108
}
You can’t perform that action at this time.
0 commit comments