vue编译报错

hhxx
  • 569
<div id="app">
        <h1>Tasks</h1>
        <ul>
            <li v-for="for task in tasks" ></li>
        </ul>

        <h1>Incomplete Tasks</h1>
        <ul>
            <li v-for="for task in incompleteTasks" v-text="task.desc"></li>
        </ul>
    </div>
let app = new Vue({
     el: "#app",
     data: {
         tasks: [
             {desc: "clean", completed: false},

             {desc: "finish paper", completed: true},

             {desc: "do ppt", completed: false},

             {desc: "find a job", completed: true}
         ]
     },

     computed: {
         incompleteTasks() {
             return this.tasks.filter((t) => t.completed)
         }
     }
 })

用vue学着写demo,结果上面的代码报了无法编译的错误

vue.js:515 [Vue warn]: failed to compile template:

<div id="app">
        <h1>Tasks</h1>
        <ul>
            <li v-for="for task in tasks"></li>
        </ul>

        <h1>Incomplete Tasks</h1>
        <ul>
            <li v-for="for task in incompleteTasks" v-text="task.desc"></li>
        </ul>
    </div>



 
(found in root instance)

请问为什么报错啊?感觉很正常的代码啊,谢谢!

回复
阅读 3k
1 个回答
  <li v-for="for task in tasks" ></li>

-->

  <li v-for="task in tasks" ></li>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏