入门
- 基本使用
- 安装Vue
- 直接引入本地或者cdn Vue地址
- 使用npm
- 使用cli
- 安装Vue
- 示例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<title>Vue</title>
</head>
<body>
<div id="app" onclick="clickVue()">
{{message}}
</div>
<script src="../js/vue01.js"></script>
</body>
</html>
js
var app = new Vue({
el:"#app",
data() {
return {
message:"hello world"
}
},
})
function clickVue() {
app.message = "click me be strong"
}
- 在引入js时引入在body内部,使js后执行,否则导致无法渲染的问题