Vue.js编译错误:no-unused-vars&no-undef

随机名称142

我目前正在尝试创建Vue.js组件。当我启动应用程序时,出现错误。错误信息如下图:

在此处输入图片说明

<template>
    <div class="hello" id="app">
         <span style="font-size:30px;cursor:pointer;" onclick="openNav()">&#9776;</span>

        <div id="mySidenav" class="sidenav">
            <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
            <a href="#">{{name1}}</a>
            <a href="#">{{name2}}</a>
            <a href="#">{{name3}}</a>
            <a href="#">{{name4}}</a>

            <div id="bottom">
                <input v-model="name1" style="margin-left: 25px;max-width: 50%;">
                <input v-model="name2" style="margin-left: 25px;max-width: 50%;">
                <input v-model="name3" style="margin-left: 25px;max-width: 50%;">
                <input v-model="name4" style="margin-left: 25px;max-width: 50%;">
            </div>

        </div>
        <h2>Lorem ipsum dolor sit amet</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque elit velit, dictum in urna et,
            vulputate ornare sapien. Phasellus sed metus sed dolor hendrerit iaculis.
            Cras eget libero sit amet massa aliquet dignissim. Vivamus faucibus lorem sit amet semper luctus.
            Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In at placerat
            felis,
            id finibus mauris. Proin maximus orci quis lacus pellentesque, ac dignissim sapien vestibulum. Maecenas
            pharetra
            vulputate semper.
            Suspendisse potenti. Donec nisi nisi, aliquam eget felis euismod, semper dictum ligula.
            Aenean mauris enim, iaculis vel malesuada vel, pulvinar et risus. Fusce sit amet orci eget diam commodo
            ultricies sed vel elit.
            Curabitur quis scelerisque est.</p>
    </div>
</template>

<script>
    //Vue App
    var app = new Vue({
        el: '#app',
        data: {
            /*
            navlink: [
                {id: 1, link: "https://www.tfbern.ch"}, 
                {id: 2, link: "https://www.tfbern.ch"},
                {id: 3, link: "https://www.tfbern.ch"},
                {id: 4, link: "https://www.tfbern.ch"}
                ]
            */

            name1: 'name 1',
            name2: 'name 2',
            name3: 'name 3',
            name4: 'name 4'
        }
    })
    export default {
        name: 'NavigationDrawer',
        props: {
            msg: String
        }
    }

    //Navbar Animation
   /* 
   function openNav() {
        document.getElementById("mySidenav").style.width = "250px";
    }

    function closeNav() {
        document.getElementById("mySidenav").style.width = "0"; -->
    }
     */
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>

Navigation-Drawer.vue


<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/>
    <App msg="test">
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import App from './components/Navigation-Drawer.vue'
export default {
  name: 'App',
  components: {
    HelloWorld,
    App
  }
}

</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

查看应用

维杰·乔希

这些是eslint的错误。有关详细信息,请参见https://eslint.org/docs/rules/no-unused-varshttps://eslint.org/docs/rules/no-undef

为了消除这些错误,请在初始化应用程序的行之前添加此行

    // eslint-disable-next-line
    var app = new Vue({ 
    // rest of the code 

确保带有的行eslint-disable-next-line已注释。这将告诉eslint忽略该行而不是掉毛它。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Vue:禁用no-unused-vars错误:最简单的修复

来自分类Dev

Vue.js错误“ app”被分配了一个值,但从未使用过no-unused-vars

来自分类Dev

如何在Vue脚本中修复“ eslint(no-unused-vars)”

来自分类Dev

在尝试投放之前,如何检查Vue js编译错误?

来自分类Dev

(Vue.js)错误:axios未定义'token'(no-undef)

来自分类Dev

方案:错误:#<undef> 不是函数

来自分类Dev

ESLint给出“ no-unused-vars”错误,用于实例化变量然后分配值

来自分类Dev

错误未能编译未定义 no-undef

来自分类Dev

在地图函数打字稿中未使用索引时,摆脱eslint @ typescript-eslint / no-unused-vars错误

来自分类Dev

11:5错误“路由器”被分配了一个值,但从未使用过no-unused-vars

来自分类Dev

错误:“$”未定义。[no-undef]

来自分类Dev

反应错误“./src/App.js 第 7 行:'APIKEY' 被分配了一个值,但从未使用过 no-unused-vars”

来自分类Dev

选择undef,undef,undef .XX

来自分类Dev

变量已定义但从未使用(no-unused-vars)

来自分类Dev

定义但从未使用过'FC'.eslint(no-unused-vars)

来自分类Dev

组件已定义但从未使用过no-unused-vars

来自分类Dev

ESLint no-unused-vars规则捕获Typescript对象的解构

来自分类Dev

eslint no-unused-vars varIgnorePattern不起作用

来自分类Dev

编译失败:ReactJS中未定义'props'no-undef

来自分类Dev

组件已注册但未使用vue / no-unused-components

来自分类Dev

React和Redux:获取未定义no-undef错误

来自分类Dev

为什么默认的导出组件在React JS中给出no-undef错误?

来自分类Dev

为什么在运行react js组件类时出现“ no-undef”错误?

来自分类Dev

错误“时刻”未在 ember.js 中定义为 no-undef

来自分类Dev

libxslt:编译错误

来自分类Dev

Hyperloop编译错误

来自分类Dev

CRTP编译错误

来自分类Dev

VBA编译错误

来自分类Dev

JavaScript编译错误

Related 相关文章

  1. 1

    Vue:禁用no-unused-vars错误:最简单的修复

  2. 2

    Vue.js错误“ app”被分配了一个值,但从未使用过no-unused-vars

  3. 3

    如何在Vue脚本中修复“ eslint(no-unused-vars)”

  4. 4

    在尝试投放之前,如何检查Vue js编译错误?

  5. 5

    (Vue.js)错误:axios未定义'token'(no-undef)

  6. 6

    方案:错误:#<undef> 不是函数

  7. 7

    ESLint给出“ no-unused-vars”错误,用于实例化变量然后分配值

  8. 8

    错误未能编译未定义 no-undef

  9. 9

    在地图函数打字稿中未使用索引时,摆脱eslint @ typescript-eslint / no-unused-vars错误

  10. 10

    11:5错误“路由器”被分配了一个值,但从未使用过no-unused-vars

  11. 11

    错误:“$”未定义。[no-undef]

  12. 12

    反应错误“./src/App.js 第 7 行:'APIKEY' 被分配了一个值,但从未使用过 no-unused-vars”

  13. 13

    选择undef,undef,undef .XX

  14. 14

    变量已定义但从未使用(no-unused-vars)

  15. 15

    定义但从未使用过'FC'.eslint(no-unused-vars)

  16. 16

    组件已定义但从未使用过no-unused-vars

  17. 17

    ESLint no-unused-vars规则捕获Typescript对象的解构

  18. 18

    eslint no-unused-vars varIgnorePattern不起作用

  19. 19

    编译失败:ReactJS中未定义'props'no-undef

  20. 20

    组件已注册但未使用vue / no-unused-components

  21. 21

    React和Redux:获取未定义no-undef错误

  22. 22

    为什么默认的导出组件在React JS中给出no-undef错误?

  23. 23

    为什么在运行react js组件类时出现“ no-undef”错误?

  24. 24

    错误“时刻”未在 ember.js 中定义为 no-undef

  25. 25

    libxslt:编译错误

  26. 26

    Hyperloop编译错误

  27. 27

    CRTP编译错误

  28. 28

    VBA编译错误

  29. 29

    JavaScript编译错误

热门标签

归档