Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function hydrate (node: TaroElement | TaroText): MiniData {
if (isText(node)) {
return {
[Shortcuts.Text]: node.nodeValue,
[Shortcuts.NodeName]: node.nodeName
}
}
const data: MiniData = {
...node.props,
[Shortcuts.Childnodes]: node.childNodes.map(hydrate),
[Shortcuts.NodeName]: node.nodeName,
uid: node.uid
}
if (node.className) {
data[Shortcuts.Class] = node.className
}
if (node.cssText) {
data[Shortcuts.Style] = node.cssText
function buildContainerTemplate (level: number, restart = false) {
let tmpl = ''
if (restart) {
tmpl = ''
} else {
tmpl = `<template is="">`
}
return `
<template name="tmpl_${level}_${Shortcuts.Container}">
${tmpl}
</template>
`
}
</template>
export function createComponentConfig () {
return {
properties: {
i: {
type: Object,
value: {
[Shortcuts.NodeName]: 'view'
}
}
},
options: {
addGlobalClass: true
},
methods: {
eh: eventHandler
}
}
}