diff --git a/package.json b/package.json index d0471e9..93df4ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bd/core", - "version": "1.5.8", + "version": "1.5.9", "type": "module", "description": "百搭UI组件库的核心", "main": "dist/index.js", diff --git a/src/index.js b/src/index.js index 5569426..a310c04 100644 --- a/src/index.js +++ b/src/index.js @@ -106,6 +106,7 @@ export class Component extends HTMLElement { this[__in_tree__] = false // 这里提前定义一次, 是为了在connectedCallback之前, 就已有赋值时报错的bug this[__changed_props__] = new Map() // 记录一次渲染周期内变化的属性 + // this[__init__]() this.root = this.shadowRoot || this.attachShadow({ mode: 'open' }) Object.defineProperty(this, '$refs', { @@ -121,9 +122,7 @@ export class Component extends HTMLElement { this[__changed_props__] = new Map() // 初始化 props this.constructor[__props__].forEach((options, prop) => { - // console.log(this, prop, this[prop], options.default) this[prop] = this[prop] === void 0 ? options.default : this[prop] - // console.log('赋值后:', prop, this[prop]) }) // 若无定义props时, 手动执行一次渲染 @@ -250,9 +249,9 @@ export class Component extends HTMLElement { // 渲染视图 [__render__]() { - let htmlText = this.render() + let ast = this.render() - this[__children__] = render(htmlText, this.root, { + this[__children__] = render(ast, this.root, { host: this, isConnected: !this[__mounted__] && this.isConnected })