<script src = "../js/vue.js"></script>
<div id="app"> </div>
-
创建 Vue 并挂载到 id 为 app 的 html 元素上
new Vue({template : '<h1>{{msg}}</h1>',data : {msg : 'Hello World'}}).$mount('#app')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app"> </div>
<script src = "../js/vue.js"></script> <script> new Vue({ template : '<h1>{{msg}}</h1>', data : { msg : 'Hello World' } }).$mount('#app')
</script>
</body>
</html>