v1.0.4
修改设置多选上限后, 不能取消的问题
This commit is contained in:
parent
6feee42b47
commit
583caf1179
2
dist/xm-select.js
vendored
2
dist/xm-select.js
vendored
File diff suppressed because one or more lines are too long
@ -139,6 +139,14 @@ class Framework extends Component{
|
|||||||
//如果是禁用状态, 不能进行操作
|
//如果是禁用状态, 不能进行操作
|
||||||
if(disabled) return;
|
if(disabled) return;
|
||||||
|
|
||||||
|
//如果现在是选中状态
|
||||||
|
if(selected && (!repeat || mandatoryDelete)){
|
||||||
|
let index = sels.findIndex(sel => sel[valueProp] == item[valueProp])
|
||||||
|
if(index != -1){
|
||||||
|
sels.splice(index, 1);
|
||||||
|
this.setState({ sels });
|
||||||
|
}
|
||||||
|
}else{
|
||||||
//查看是否设置了多选上限
|
//查看是否设置了多选上限
|
||||||
let maxCount = toNum(max);
|
let maxCount = toNum(max);
|
||||||
if(maxCount > 0 && sels.length >= maxCount){
|
if(maxCount > 0 && sels.length >= maxCount){
|
||||||
@ -150,14 +158,6 @@ class Framework extends Component{
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果现在是选中状态
|
|
||||||
if(selected && (!repeat || mandatoryDelete)){
|
|
||||||
let index = sels.findIndex(sel => sel[valueProp] == item[valueProp])
|
|
||||||
if(index != -1){
|
|
||||||
sels.splice(index, 1);
|
|
||||||
this.setState({ sels });
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//如果是单选模式
|
//如果是单选模式
|
||||||
if(radio){
|
if(radio){
|
||||||
this.setState({ sels: [item] });
|
this.setState({ sels: [item] });
|
||||||
|
Loading…
Reference in New Issue
Block a user