本文介绍了总是出现“不允许尾随空间"的错误;在VueJS中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目使用Vue和Vuetify,并且每当我编译时,此错误总是在我的CLI中出现:不允许尾随空格 src \ App.vue:39:11"

My project uses Vue and Vuetify and whenever I compile, this error always come out in my CLI: " Trailing spaces not allowed src\App.vue:39:11"

我正在使用ESlint,但是我已经添加了注释"/* eslint-disable eol-last */",但是规则仍然没有被禁用.

I am using ESlint but I already added the comment "/* eslint-disable eol-last */ " but the rules are still not being disabled.I am new to this framework.

这是我的App.vue文件:

here is my App.vue file:

<template>
  <div id="app">
    <div class="header">
      <h4>VUE.js SPA</h4>
     </div>
<v-card class="align-left">
  <v-navigation-drawer permanent>
    <v-list-item>
      <v-list-item-content>
        <v-list-item-title class="title">
          <router-link to="/" class="nav-link">Home</router-link>
        </v-list-item-title>
      </v-list-item-content>
      <v-list-item-content>
        <v-list-item-title class="title">
          <router-link to="/about" class="nav-link">About Me</router-link>
        </v-list-item-title>
      </v-list-item-content>
      <v-list-item-content>
        <v-list-item-title class="title">
          <router-link to="/works" class="nav-link">Works</router-link>
        </v-list-item-title>
      </v-list-item-content>
    </v-list-item>

    <v-divider></v-divider>

    <v-list dense nav>
      <v-list-item link>
        <v-list-item-content>
          <v-list-item-title>{{ item.title }}</v-list-item-title>
        </v-list-item-content>
      </v-list-item>
    </v-list>
  </v-navigation-drawer>
</v-card>
<div class="content">
  <router-view></router-view>
</div>
 </div>
</template>

<script>
 export default {
  data () {
    return {
      items: [
        { title: 'Home' },
        { title: 'About' },
        { title: 'Works' }
      ]
    }
   }
  }
 </script>

推荐答案

我认为这是一个vscode问题.请尝试以下操作:

I think its a vscode issue. Try the following:

  1. 在vscode中转到设置(ctrl +,)
  2. 在设置搜索栏中,键入修剪尾随空格"
  3. 在下面选中修剪尾随空白"选项.
  4. 重新启动vscode.
  5. 现在,每当您保存文件时,vscode都会自动修剪尾随空格.

让我知道问题是否仍然存在.

Let me know if still the problem persists.

以上解决方案不起作用,但仍将以上解决方案保留给他人.

The above solution doesn't work, but still keeping the above solution for others.

而不是使用"/* eslint-disable eol-last /",而不是使用"/ eslint-disable no-trailing-spaces */"

Instead of using "/* eslint-disable eol-last /" use this "/ eslint-disable no-trailing-spaces */"

这篇关于总是出现“不允许尾随空间"的错误;在VueJS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 06:30