内置注册方法

pull/1/head
yutent 2023-03-21 16:45:10 +08:00
parent 439287da9c
commit 836d566f55
2 changed files with 8 additions and 1 deletions

View File

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

View File

@ -91,6 +91,13 @@ export class Component extends HTMLElement {
delete this.props delete this.props
} }
static reg(name = '') {
name = 'wc-' + name
if (!customElements.get(name)) {
customElements.define(name, this)
}
}
constructor() { constructor() {
super() super()
this[__pending__] = false this[__pending__] = false