render增加容错处理
parent
87496a1487
commit
2aa9ab5af0
14
src/index.js
14
src/index.js
|
@ -376,11 +376,15 @@ export class Component extends HTMLElement {
|
||||||
|
|
||||||
// 渲染视图
|
// 渲染视图
|
||||||
#render() {
|
#render() {
|
||||||
let ast = this.render()
|
try {
|
||||||
this[__children__] = render(ast, this.root, {
|
let ast = this.render()
|
||||||
host: this,
|
this[__children__] = render(ast, this.root, {
|
||||||
isConnected: !this[__mounted__] && this.isConnected
|
host: this,
|
||||||
})
|
isConnected: !this[__mounted__] && this.isConnected
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 几个生命周期回调
|
// 几个生命周期回调
|
||||||
created() {}
|
created() {}
|
||||||
|
|
Loading…
Reference in New Issue