html中引入Vue
在正式使用Vue单页面结构前,在html中使用vue。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>01 html中引入Vue</title>
</head>
<body>
<!-- html 部分 -->
<div id="app">
<h1>{{ message }}</h1>
</div>
<!-- script 部分 -->
<script src="./js/vue.js"></script>
<script>
const app = new Vue({
el: "#app",
data: {
message: "你好",
},
});
</script>
</body>
</html>
el挂载元素时不要忘记“#”