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-for`
|
||||||
- [ ] `v-once`
|
- [ ] `v-once`
|
||||||
- [x] `v-html`
|
- [x] `v-html`
|
||||||
- [ ] `v-text`
|
- [x] `v-text`
|
||||||
- [ ] `v-show`
|
- [ ] `v-show`
|
||||||
- [ ] `v-pre`
|
- [ ] `v-pre`
|
||||||
- [ ] `v-cloak`
|
- [ ] `v-cloak`
|
||||||
|
|
|
@ -216,6 +216,7 @@ function transformElement(ctx: TransformContext<ElementNode>) {
|
||||||
if (children.length) transformChildren(ctx)
|
if (children.length) transformChildren(ctx)
|
||||||
|
|
||||||
// TODO remove unnecessary close tag
|
// TODO remove unnecessary close tag
|
||||||
|
// TODO: [bug] self closing <div />
|
||||||
if (!node.isSelfClosing) ctx.template += `</${tag}>`
|
if (!node.isSelfClosing) ctx.template += `</${tag}>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,6 +355,13 @@ function transformProp(
|
||||||
element: ctx.getElementId(),
|
element: ctx.getElementId(),
|
||||||
})
|
})
|
||||||
break
|
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="inc">inc</button>
|
||||||
<button @click="dec">dec</button>
|
<button @click="dec">dec</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-html="html" />
|
<div v-html="html"></div>
|
||||||
|
<div v-text="html"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue