2017-08-30 30 views
0

這是我的代碼,我似乎已經做了一切正確。 作爲輸出可能是什麼問題只{{消息}}Vue不能在一個簡單的例子

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>Title</title> 

</head> 
<body> 
<div id="app"> 
<h1>{{message}}</h1> 
</div> 

<script src="https://vuejs.org/js/vue.js"/> 
<script> 
    new Vue({ 
     el: '#app', 
     data:{ 
      message: "Yow" 
     }, 
     mounted: function() { 
      console.log("Mounted") 
     } 
    }); 
</script> 
</body> 
</html> 

,它只是輸出{{消息}}

+0

只有你正在運行的唯一的發展模式VUE –

回答

0

嗨,老兄,你忘了關在vue.js腳本結束腳本標籤/ API

你被渲染腳本標記整個HTML部分一樣,你可以在控制檯見下圖: enter image description here

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>Title</title> 

</head> 
<body> 

<div id="app"> 
<h1>{{message}}</h1> 
</div> 
<script src="https://vuejs.org/js/vue.js"/> 
</script> 
<script> 
    console.log('hi'); 
    var app = new Vue({ 
     el: '#app', 
     data:{ 
      message: 'yow' 
     }, 
     mounted: function() { 
      console.log("Mounted") 
     } 
    }); 
</script> 
</body> 

而且總是inlude API /主/ CDN未來任何操作JS的鏈接文件