一如蚜、官方網(wǎng)站
https://cn.vuejs.org/v2/guide/index.html
二压恒、安裝
1、直接用<script>引入方式
2错邦、下載開發(fā)版本
3探赫、將vue.js保存到項目中
4、在html代碼中引入js撬呢,將js引入代碼放在head伦吠,不要放在body中,避免出現(xiàn)抖屏
<head>
<meta charset="UTF-8">
<title>Vue學(xué)習(xí)</title>
<script src="./vue.js"></script>
</head>
5、數(shù)據(jù)掛載
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue學(xué)習(xí)</title>
<script src="./vue.js"></script>
</head>
<body>
<div id="root">{{msg}}</div>
<script>
new Vue({
el:"#root",
data:{
msg:"hello world"
}
})
</script>
</body>
</html>
關(guān)鍵字說明:
el 掛載點
data 數(shù)據(jù)
msg 參數(shù)化的變量名