修复渲染失败页面监听错误的问题
This commit is contained in:
@@ -25,7 +25,8 @@ class xmOptions {
|
||||
let updateData = !!options.data;
|
||||
|
||||
//记录最新的配置项
|
||||
this.options = deepMerge(this.options, options);
|
||||
this.options = deepMerge(this.options, options);
|
||||
this.options.__render_success = false;
|
||||
|
||||
//如果dom不存在, 则不进行渲染事项
|
||||
let { dom } = this.options;
|
||||
@@ -45,7 +46,9 @@ class xmOptions {
|
||||
}
|
||||
|
||||
render(<Framework { ...this.options } __update={ Date.now() } updateData={ updateData } />, dom);
|
||||
|
||||
|
||||
this.options.__render_success = true;
|
||||
|
||||
//返回多选对象
|
||||
return this;
|
||||
}
|
||||
@@ -213,7 +216,7 @@ class xmOptions {
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 动态操作树状结构的节点展开状态
|
||||
*/
|
||||
@@ -250,6 +253,15 @@ class xmOptions {
|
||||
}
|
||||
childData[this.options.el].upDate(sels, false)
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 滚动到某个选项
|
||||
*/
|
||||
scroll(val){
|
||||
let opt = this.options.dom.querySelector(`.xm-option[value="${ val }"]`);
|
||||
opt && opt.scrollIntoView(false)
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
|
||||
let instance = new Select(options);
|
||||
//已经渲染
|
||||
if (instance) {
|
||||
if (instance && instance.__render_success) {
|
||||
datas[el] = instance;
|
||||
}
|
||||
return instance;
|
||||
|
||||
Reference in New Issue
Block a user