鍍金池/ 問答/HTML/ vue 報錯 SyntaxError: Unexpected string in

vue 報錯 SyntaxError: Unexpected string in。。。

新手,最近剛開始學(xué)vue,一個簡單的todoList實例

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        
        <style type="text/css">
            
        </style>
    </head>
    <body>
        <div id="todo">
            <h2>小目標(biāo)列表</h2>
            <h3>添加小目標(biāo)</h3>
            <input type="text" placeholder="ded" 
             @keyup.13="addList" v-model="addText"\>
             <p>共有{{prolist.length}}個目標(biāo)</p>
             <!--v-for遍歷prolist-->
            <li class="li1" v-for="list in prolist">
              <div>
                <span class="type-span"></span>
                <span>{{list.name}}</span>
                <span class="close">X</span>
              </div>
            </li>

        </div>
        <script src="../../vus.js"></script>
        <script>
            new Vue({
               el: "#todo",
               data: {
                       addText:'',
                       //name-名稱,status-完成狀態(tài)
                       prolist:[
                         {name:"HTML5",status:false},
                         {name:"CSS3",status:false},
                         {name:"vue",status:false},
                         {name:"react",status:false}
                        ]
                       },
                computed:{
        
                       },
                methods:{
                    addList(){
                     //添加進(jìn)來默認(rèn)status=false,就是未完成狀態(tài)
                     this.prolist.push({
                       name:this.addText,
                       status:false
                     });
                     //添加后,清空addText
                    this.addText="";
                  }
               }
            });
            
        </script>
    </body>
</html>

上面的代碼在瀏覽器中會報錯。。。

SyntaxError: Unexpected string in

with(this){return _c('div',{attrs:{"id":"todo"}},[_c('h2',[_v("小目標(biāo)列表")]),_v(" "),_c('h3',[_v("添加小目標(biāo)")]),_v(" "),_c('input',{directives:[{name:"model",rawName:"v-model",value:(addText),expression:"addText"}],attrs:{"type":"text","placeholder":"ded","":""},domProps:{"value":(addText)},on:{"keyup":function($event){if(!('button' in $event)&&$event.keyCode!==13)return null;return addList($event)},"input":function($event){if($event.target.composing)return;addText=$event.target.value}}}),_v(" "),_c('p',[_v("共有"+_s(prolist.length)+"個目標(biāo)")]),_v(" "),_l((prolist),function(list){return _c('li',{staticClass:"li1"},[_c('div',[_c('span',{staticClass:"type-span"}),_v(" "),_c('span',[_v(_s(list.name))]),_v(" "),_c('span',{staticClass:"close"},[_v("X")])])])})],2)}

回答
編輯回答
抱緊我

最后的關(guān)閉寫錯了 應(yīng)該是/

 <input type="text" placeholder="ded" 
 @keyup.13="addList" v-model="addText"\>
2018年6月6日 23:44
編輯回答
失心人

粗心大意,手伸過來

2018年3月14日 03:09
編輯回答
胭脂淚

問題應(yīng)該就是第一位講的,建議用IDE寫代碼,像webstorm, vscode 這種低級錯誤會提示

2017年12月13日 01:27