<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./vue.min.js"></script>
</head>
<body>
<div id="app">
{{hello}}
</div>
<script>
var vm=new Vue({
el:"#app",
data:{hello:"hello"},
beforeCreate:function(){
console.log("在创建Vue之前,这里执行了");
},
mounted:function(){
console.log("el挂载成功"+this.$el);
},
created:function(){
console.log("在创建Vue成功之后,这里执行了");
},
destoryed:function(){
console.log("销毁成功");
}
});
console.log(vm.$el);
</script>
</body>
</html>
Vue生命周期
最新推荐文章于 2022-10-31 10:18:26 发布