生命周期测试
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vue 生命周期</title>
<script src="./vue.js"></script>
</head>
<body>
<div id="app"></div>
<script>
var vm = new Vue({
el: "#app",
template:"<div>{{test}}</div>",
data:{
test:"hello world"
},
beforeCreate:function(){
console.log("beforeCreate");
},
created:function(){
console.log("created");
},
beforeMount:function(){
console.log("beforeMount");
},
mounted:function(){
console.log("mounted");
},
beforeDestroy:function(){
console.log("beforeDestroy");
},
destroyed:function(){
console.log("destroyed");
},
beforeUpdate:function(){
console.log("beforeUpdate");
},
updated:function(){
console.log("updated");
}
})
</script>
</body>
</html>