调整attribute定义

pull/1/head
yutent 2023-03-20 10:43:17 +08:00
parent 6ca5045bd0
commit 58d4277964
3 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@bd/core", "name": "@bd/core",
"version": "1.5.2", "version": "1.5.3",
"type": "module", "type": "module",
"description": "百搭UI组件库的核心", "description": "百搭UI组件库的核心",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -318,6 +318,7 @@ class TemplateInstance {
} else if (templatePart.type === ELEMENT_PART) { } else if (templatePart.type === ELEMENT_PART) {
part = new ElementPart(node, this, options) part = new ElementPart(node, this, options)
} }
// console.log(node)
if (node.nodeType === 1 && node.getAttribute('ref')) { if (node.nodeType === 1 && node.getAttribute('ref')) {
if (options.host.$refs) { if (options.host.$refs) {
options.host.$refs[node.getAttribute('ref')] = node options.host.$refs[node.getAttribute('ref')] = node

View File

@ -38,7 +38,7 @@ export class Component extends HTMLElement {
this.finalize() this.finalize()
this[__props__].forEach((options, prop) => { this[__props__].forEach((options, prop) => {
options.attribute && list.push(prop.toLowerCase()) list.push(prop.toLowerCase())
}) })
return list return list
} }
@ -151,6 +151,7 @@ export class Component extends HTMLElement {
let options = this.#getPropOptions(name) let options = this.#getPropOptions(name)
if (options.attribute === false) { if (options.attribute === false) {
this.removeAttribute(name)
return return
} }