mirror of https://github.com/vuejs/core.git
feat: v-text
This commit is contained in:
parent
74b4328337
commit
dc3bc7016e
|
@ -20,7 +20,7 @@ See the To-do list below or `// TODO` comments in code (`compiler-vapor` and `ru
|
|||
- [ ] `v-for`
|
||||
- [ ] `v-once`
|
||||
- [x] `v-html`
|
||||
- [ ] `v-text`
|
||||
- [x] `v-text`
|
||||
- [ ] `v-show`
|
||||
- [ ] `v-pre`
|
||||
- [ ] `v-cloak`
|
||||
|
|
|
@ -216,6 +216,7 @@ function transformElement(ctx: TransformContext<ElementNode>) {
|
|||
if (children.length) transformChildren(ctx)
|
||||
|
||||
// TODO remove unnecessary close tag
|
||||
// TODO: [bug] self closing <div />
|
||||
if (!node.isSelfClosing) ctx.template += `</${tag}>`
|
||||
}
|
||||
|
||||
|
@ -354,6 +355,13 @@ function transformProp(
|
|||
element: ctx.getElementId(),
|
||||
})
|
||||
break
|
||||
case 'text':
|
||||
ctx.registerEffect(expr, {
|
||||
type: IRNodeTypes.SET_TEXT,
|
||||
loc: node.loc,
|
||||
element: ctx.getElementId(),
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ globalThis.html = html
|
|||
<button @click="inc">inc</button>
|
||||
<button @click="dec">dec</button>
|
||||
</div>
|
||||
<div v-html="html" />
|
||||
<div v-html="html"></div>
|
||||
<div v-text="html"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue