提交 af108fae 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

wip(uts): vBind

上级 99d9ce91
......@@ -158,7 +158,7 @@ describe('compiler: v-bind', () => {
`<text :style="{
}" />`,
`createElementVNode("text", utsMapOf({
style: normalizeStyle(utsMapOf({
style: normalizeStyle(utsMapOf<string, any | null>({
}))
}), null, 4 /* STYLE */)`
)
......
......@@ -71,7 +71,12 @@ export const transformBind: DirectiveTransform = (dir, _node, context) => {
walk(ast, {
enter(node: Node) {
if (node.type === 'ObjectExpression') {
s.prependLeft(node.start!, 'utsMapOf(')
const type = s.original
.substring(1, s.original.length - 1)
.replaceAll(/\s+/g, '')
? ''
: '<string, any | null>'
s.prependLeft(node.start!, `utsMapOf${type}(`)
s.prependRight(node.end!, ')')
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册