<!DOCTYPE html>javascript
<html>css
<head>html
<meta charset="utf-8" />vue
<title>模板</title>java
</head>ide
<script type="text/javascript" src="js/vue.js" ></script>spa
<script>雙向綁定
window.onload = function(){調試
//配置是否容許檢查代碼,方便調試,生產環境中設置爲falsehtm
Vue.config.devtools = true; //檢查代碼
Vue.config.productioinTip = false; //有強迫症的,能夠關掉生產中的提示信息
let vm = new Vue({
el: "#div1",
data:{
msg:'hello world!!!'
},
created:function(){
alert(1111);
}
});
}
</script>
<style type="text/css">
[v-cloak]{
display: none;
}
</style>
<body>
<div id="div1">
<input type="text" v-model="msg">
<h1>aaaa<span v-cloak>`msg`</span></h1> <!-- 防止msg-->
<h1 v-text="msg"></h1> <!--v-text 不能解析html代碼-->
<h1 v-html="msg"></h1> <!--v-html 能夠解析html代碼-->
<h2 v-once>`msg`</h2> <!--只綁定一次,雙向綁定改變不了-->
<h3 v-pre>`msg`</h3> <!--當須要輸出{{}}時,能夠不編譯{{}}符號,以文本形式輸出-->
</div>
</body>
</html>