修复渲染失败页面监听错误的问题
This commit is contained in:
parent
16de57e340
commit
b47c8cfcb9
@ -25,7 +25,6 @@ var demo1 = xmSelect.render({
|
|||||||
list: ['ALL', 'REVERSE', 'CLEAR']
|
list: ['ALL', 'REVERSE', 'CLEAR']
|
||||||
},
|
},
|
||||||
filterable: true,
|
filterable: true,
|
||||||
height: 'auto',
|
|
||||||
data(){
|
data(){
|
||||||
return [
|
return [
|
||||||
{name: '销售员', value: -1, disabled: true, children: [
|
{name: '销售员', value: -1, disabled: true, children: [
|
||||||
|
20
package.json
20
package.json
@ -10,36 +10,36 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"babel-polyfill": "^6.26.0",
|
||||||
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
|
"element-ui": "^2.12.0",
|
||||||
|
"highlight.js": "^9.15.10",
|
||||||
|
"preact": "^10.4.6",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-router": "^3.1.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
"@babel/core": "^7.4.0",
|
"@babel/core": "^7.4.0",
|
||||||
"@babel/preset-env": "^7.4.2",
|
"@babel/preset-env": "^7.4.2",
|
||||||
"babel-loader": "^8.0.5",
|
"babel-loader": "^8.0.5",
|
||||||
"babel-plugin-transform-react-jsx": "^6.24.1",
|
"babel-plugin-transform-react-jsx": "^6.24.1",
|
||||||
"babel-polyfill": "^6.26.0",
|
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
|
||||||
"cross-env": "^6.0.0",
|
"cross-env": "^6.0.0",
|
||||||
"css-loader": "^3.0.0",
|
"css-loader": "^3.0.0",
|
||||||
"element-ui": "^2.12.0",
|
|
||||||
"file-loader": "^4.2.0",
|
"file-loader": "^4.2.0",
|
||||||
"highlight.js": "^9.15.10",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"less": "^3.9.0",
|
"less": "^3.9.0",
|
||||||
"less-loader": "^4.1.0",
|
"less-loader": "^4.1.0",
|
||||||
"markdown-it": "^10.0.0",
|
"markdown-it": "^10.0.0",
|
||||||
"markdown-it-anchor": "^5.2.4",
|
"markdown-it-anchor": "^5.2.4",
|
||||||
"markdown-it-chain": "^1.3.0",
|
"markdown-it-chain": "^1.3.0",
|
||||||
"markdown-it-container": "^2.0.0",
|
"markdown-it-container": "^2.0.0",
|
||||||
"preact": "^10.4.6",
|
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
"transliteration": "^2.1.7",
|
"transliteration": "^2.1.7",
|
||||||
"url-loader": "^2.1.0",
|
"url-loader": "^2.1.0",
|
||||||
"vue": "^2.6.10",
|
|
||||||
"vue-loader": "^15.7.1",
|
"vue-loader": "^15.7.1",
|
||||||
"vue-router": "^3.1.3",
|
|
||||||
"vue-template-compiler": "^2.6.10",
|
"vue-template-compiler": "^2.6.10",
|
||||||
"webpack": "^4.29.6",
|
"webpack": "^4.29.6",
|
||||||
"webpack-cli": "^3.3.0",
|
"webpack-cli": "^3.3.0",
|
||||||
"webpack-dev-server": "^3.2.1"
|
"webpack-dev-server": "^3.2.1"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"html-webpack-plugin": "^3.2.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ class xmOptions {
|
|||||||
|
|
||||||
//记录最新的配置项
|
//记录最新的配置项
|
||||||
this.options = deepMerge(this.options, options);
|
this.options = deepMerge(this.options, options);
|
||||||
|
this.options.__render_success = false;
|
||||||
|
|
||||||
//如果dom不存在, 则不进行渲染事项
|
//如果dom不存在, 则不进行渲染事项
|
||||||
let { dom } = this.options;
|
let { dom } = this.options;
|
||||||
@ -46,6 +47,8 @@ class xmOptions {
|
|||||||
|
|
||||||
render(<Framework { ...this.options } __update={ Date.now() } updateData={ updateData } />, dom);
|
render(<Framework { ...this.options } __update={ Date.now() } updateData={ updateData } />, dom);
|
||||||
|
|
||||||
|
this.options.__render_success = true;
|
||||||
|
|
||||||
//返回多选对象
|
//返回多选对象
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -252,6 +255,15 @@ class xmOptions {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 滚动到某个选项
|
||||||
|
*/
|
||||||
|
scroll(val){
|
||||||
|
let opt = this.options.dom.querySelector(`.xm-option[value="${ val }"]`);
|
||||||
|
opt && opt.scrollIntoView(false)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default xmOptions;
|
export default xmOptions;
|
||||||
|
@ -23,7 +23,7 @@ export default {
|
|||||||
|
|
||||||
let instance = new Select(options);
|
let instance = new Select(options);
|
||||||
//已经渲染
|
//已经渲染
|
||||||
if (instance) {
|
if (instance && instance.__render_success) {
|
||||||
datas[el] = instance;
|
datas[el] = instance;
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
|
Loading…
Reference in New Issue
Block a user