vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.98k stars 33.68k forks source link

tsx下使用v-html报错 #10307

Closed aoi-umi closed 5 years ago

aoi-umi commented 5 years ago

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

PreciousnessX commented 5 years ago

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

aoi-umi commented 5 years ago

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

用tsx的,不是字符串模板

haoqunjiang commented 5 years ago

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

<p domPropsInnerHTML={html} />

TSX 和模板语法是不一样的

dyf19118 commented 6 months ago

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

<p domPropsInnerHTML={html} />

TSX 和模板语法是不一样的

sorry for comment on closed issue, in vue 2.7.14 project, when using domPropsInnerHTML property on JSX elements in setup's return function, it raises error Property 'domPropsInnerHTML' does not exist on type 'ElementAttrs', it seems that vue's jsx type definition only supports innerHTML but not domPropsInnerHTML