parent
8cebdd1994
commit
d0af1270dc
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@bd/core",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"type": "module",
|
||||
"description": "百搭UI组件库的核心",
|
||||
"main": "dist/index.js",
|
||||
|
|
15
src/html.js
15
src/html.js
|
@ -134,7 +134,7 @@ function getTemplateHtml(strings, type) {
|
|||
return [htmlResult, attrNames]
|
||||
}
|
||||
class Template {
|
||||
constructor({ strings, values, ['__dom_type__']: type }, options) {
|
||||
constructor({ strings, ['__dom_type__']: type }, options) {
|
||||
this.parts = []
|
||||
let node
|
||||
let nodeIndex = 0
|
||||
|
@ -157,12 +157,6 @@ class Template {
|
|||
let attrsToRemove = []
|
||||
|
||||
for (let name of node.getAttributeNames()) {
|
||||
if (name === 'ref') {
|
||||
options.host.$refs[node.getAttribute('ref')] = node
|
||||
node.removeAttribute('ref')
|
||||
continue
|
||||
}
|
||||
|
||||
if (
|
||||
name.endsWith(boundAttributeSuffix) ||
|
||||
name.startsWith(marker)
|
||||
|
@ -324,6 +318,11 @@ class TemplateInstance {
|
|||
} else if (templatePart.type === ELEMENT_PART) {
|
||||
part = new ElementPart(node, this, options)
|
||||
}
|
||||
if (node.nodeType === 1 && node.getAttribute('ref')) {
|
||||
if (options.host.$refs) {
|
||||
options.host.$refs[node.getAttribute('ref')] = node
|
||||
}
|
||||
}
|
||||
this._parts.push(part)
|
||||
templatePart = parts[++partIndex]
|
||||
}
|
||||
|
@ -669,6 +668,8 @@ export function render(value, container, options = {}) {
|
|||
}
|
||||
part._$setValue(value)
|
||||
|
||||
// console.log(container, options.host, options.host.$refs)
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ export class Component extends HTMLElement {
|
|||
value: Object.create(null),
|
||||
enumerable: false
|
||||
})
|
||||
|
||||
this.created()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue