Skip to content

Commit f3a6ad1

Browse files
committed
docs: update
1 parent f3d794a commit f3a6ad1

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

docs/rules/no-v-text-v-html-on-component.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ If you use v-text / v-html on a component, it will overwrite the component's con
2525
<!-- ✓ GOOD -->
2626
<div v-text="content"></div>
2727
<div v-html="html"></div>
28+
<svg><g v-text="content" /></svg>
29+
<math><mi v-text="content" /></math>
2830
<MyComponent>{{ content }}</MyComponent>
2931
3032
<!-- ✗ BAD -->
3133
<MyComponent v-text="content"></MyComponent>
3234
<MyComponent v-html="html"></MyComponent>
35+
<g v-text="content" />
36+
<mi v-text="content" />
3337
</template>
3438
```
3539

@@ -39,14 +43,15 @@ If you use v-text / v-html on a component, it will overwrite the component's con
3943

4044
```json
4145
{
42-
"vue/no-v-text-v-html-on-component": [
43-
"error",
44-
{ "allow": ["router-link", "nuxt-link"] }
45-
]
46+
"vue/no-v-text-v-html-on-component": ["error", {
47+
"allow": ["router-link", "nuxt-link"],
48+
"ignoreElementNamespaces": false
49+
}]
4650
}
4751
```
4852

4953
- `allow` (`string[]`) ... Specify a list of custom components for which the rule should not apply.
54+
- `ignoreElementNamespaces` (`boolean`) ... Specify whether to ignore the namespace restrictions for SVG and MathML elements, so that the rule should not apply. Default is `false`.
5055

5156
### `{ "allow": ["router-link", "nuxt-link"] }`
5257

@@ -65,6 +70,20 @@ If you use v-text / v-html on a component, it will overwrite the component's con
6570

6671
</eslint-code-block>
6772

73+
### `{ "ignoreElementNamespaces": true }`
74+
75+
<eslint-code-block :rules="{'vue/no-v-text-v-html-on-component': ['error', { ignoreElementNamespaces: true }]}">
76+
77+
```vue
78+
<template>
79+
<!-- ✓ GOOD -->
80+
<g v-text="content" /> <!-- <svg> -->
81+
<mi v-text="content" /> <!-- <math> -->
82+
</template>
83+
```
84+
85+
</eslint-code-block>
86+
6887
## :rocket: Version
6988

7089
This rule was introduced in eslint-plugin-vue v8.4.0

0 commit comments

Comments
 (0)