Parsing error: missing-whitespace-between-attributes vue/no-parsing-error
时间: 2024-04-25 15:20:53 浏览: 14
引用\[1\]: 这个错误是由于在Vue模板中的双引号没有正确地包裹参数引起的。解决这个问题的方法是将原来的双引号改成单引号或者反引号。例如,将`<button @click="change("all")">点击</button>`改为`<button @click="change('all')">点击</button>`或者`<button @click="change(`all`)">点击</button>`。这样就可以解决这个错误了。
#### 引用[.reference_title]
- *1* [missing-whitespace-between-attributes,unexpected-character-in-attribute-name](https://blog.csdn.net/weixin_41654160/article/details/118049188)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关问题
[vue/no-parsing-error] Parsing error: missing-whitespace-between-attributes.eslint-plugin-vue
这个错误是由 ESLint 的 Vue 插件报告的。它表示在 Vue 模板中发现了一个解析错误,具体是属性之间缺少了空格。
在 Vue 模板中,每个属性应该在其前后有一个空格,例如:
```html
<template>
<div class="container" v-if="isVisible">
<p v-for="item in items" :key="item.id">{{ item.name }}</p>
</div>
</template>
```
如果你在属性之间没有加入空格,就会触发这个错误。
你可以通过在属性之间添加空格来解决这个问题:
```html
<template>
<div class="container" v-if="isVisible">
<p v-for="item in items" :key="item.id">{{ item.name }}</p>
</div>
</template>
```
确保每个属性的前后都有一个空格,这样就不会再触发这个错误了。
Parsing error: x-invalid-namespace vue/no-parsing-error
这个错误通常是由于 Vue 模板中使用了无效的命名空间导致的。请检查你的 Vue 模板,确保所有的命名空间都是有效的,例如:
```
<template>
<div>
<my-component></my-component>
</div>
</template>
<script>
import MyComponent from './MyComponent.vue'
export default {
components: {
'my-component': MyComponent // 注意这里的命名空间应该是小写的
}
}
</script>
```
如果你使用了带有无效命名空间的 HTML 标签,例如 `<x-template>` 或 `<svg:rect>`,则也会出现这个错误。请确保你使用的命名空间是有效的,或者使用默认的命名空间。例如:
```
<template>
<div>
<x-template></x-template> <!-- 这里的命名空间是无效的 -->
<svg>
<rect></rect> <!-- 这里使用了默认的命名空间 -->
</svg>
</div>
</template>
```