render增加容错处理

master
yutent 2023-09-04 11:25:17 +08:00
parent 87496a1487
commit 2aa9ab5af0
1 changed files with 9 additions and 5 deletions

View File

@ -376,11 +376,15 @@ export class Component extends HTMLElement {
// 渲染视图 // 渲染视图
#render() { #render() {
try {
let ast = this.render() let ast = this.render()
this[__children__] = render(ast, this.root, { this[__children__] = render(ast, this.root, {
host: this, host: this,
isConnected: !this[__mounted__] && this.isConnected isConnected: !this[__mounted__] && this.isConnected
}) })
} catch (err) {
console.error(err)
}
} }
// 几个生命周期回调 // 几个生命周期回调
created() {} created() {}