Vue: tsx下使用v-html报错

Created on 24 Jul 2019  ·  3Comments  ·  Source: vuejs/vue

Version

2.6.10

Reproduction link

https://github.com/aoi-umi/demo/commit/b738088f5d934b9c8e53a1f4a3e4a761966af7b0#diff-95d77e7cf3ad25bef47127a93ba4738b

Steps to reproduce

tsx下使用v-html

<p v-html={params.row.content}></p>;

无法显示,报以下错误
Failed to resolve directive: html

What is expected?

正确显示html内容

What is actually happening?

Failed to resolve directive: html

Most helpful comment

https://github.com/vuejs/jsx#directives

<p domPropsInnerHTML={html} />

TSX 和模板语法是不一样的

All 3 comments

<p v-html="params.row.content"></p>

<p v-html="params.row.content"></p>

用tsx的,不是字符串模板

https://github.com/vuejs/jsx#directives

<p domPropsInnerHTML={html} />

TSX 和模板语法是不一样的

Was this page helpful?
0 / 5 - 0 ratings