bug修复
This commit is contained in:
maplemei
2019-11-07 10:52:51 +08:00
parent b3026c7dce
commit 53521d7854
14 changed files with 53 additions and 21 deletions

View File

@@ -77,7 +77,7 @@ export function deepMerge(obj1, obj2) {
export function mergeArr(arr1, arr2, prop) {
let value = prop.value;
let result = [...arr2];
for (let i in arr1) {
for (let i = 0; i < arr1.length; i++) {
let item = arr1[i];
if (!arr2.find(a => a[value] == item[value])) {
result.push(item);

View File

@@ -79,7 +79,7 @@ class xmOptions {
//更新渲染
this.update({ ...initData[initVal.el]});
//子组件初始化
childs[this.options.el].reset();
childs[this.options.el].reset(this.options, true);
return this;
}

View File

@@ -21,12 +21,12 @@ class Framework extends Component{
this.bodyView = null;
}
reset(props){
reset(props, refresh = false){
//用于多选上限的边框颜色变化
this.updateBorderColor('');
let old = this.state.data;
this.resetDate(props.data);
JSON.stringify(props.data) !== JSON.stringify(old) && this.value(props.initValue ? props.initValue : this.findValue(this.state.data), !!this.state.show);
(JSON.stringify(props.data) !== JSON.stringify(old) || refresh) && this.value(props.initValue ? props.initValue : this.findValue(this.state.data), !!this.state.show);
}
findValue(data){

View File

@@ -19,7 +19,7 @@ const xmSelect = {
}
return instance;
},
get(filter){
get(filter, single){
let type = Object.prototype.toString.call(filter);
let method;
switch (type){
@@ -36,7 +36,8 @@ const xmSelect = {
break;
}
let keys = Object.keys(object)
return (method ? keys.filter(method) : keys).map(key => object[key]).filter(instance => selector(instance.options.el));
let list = (method ? keys.filter(method) : keys).map(key => object[key]).filter(instance => selector(instance.options.el));
return single ? list[0] : list;
},
batch(filter, method){
let args = [ ...arguments ];