From 58d42779649b39b9ce1672762d59183c9912b882 Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 20 Mar 2023 10:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4attribute=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/html.js | 1 + src/index.js | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a4892e0..93e1f35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bd/core", - "version": "1.5.2", + "version": "1.5.3", "type": "module", "description": "百搭UI组件库的核心", "main": "dist/index.js", diff --git a/src/html.js b/src/html.js index 84e2e8d..4ac62da 100644 --- a/src/html.js +++ b/src/html.js @@ -318,6 +318,7 @@ class TemplateInstance { } else if (templatePart.type === ELEMENT_PART) { part = new ElementPart(node, this, options) } + // console.log(node) if (node.nodeType === 1 && node.getAttribute('ref')) { if (options.host.$refs) { options.host.$refs[node.getAttribute('ref')] = node diff --git a/src/index.js b/src/index.js index 9377616..34b5ca6 100644 --- a/src/index.js +++ b/src/index.js @@ -38,7 +38,7 @@ export class Component extends HTMLElement { this.finalize() this[__props__].forEach((options, prop) => { - options.attribute && list.push(prop.toLowerCase()) + list.push(prop.toLowerCase()) }) return list } @@ -151,6 +151,7 @@ export class Component extends HTMLElement { let options = this.#getPropOptions(name) if (options.attribute === false) { + this.removeAttribute(name) return }