vue2.0生命周期
{{data}}var myVue = new Vue({el:'#app',data:{data:'aaaa',info:'nono'},beforeCreate:function(){console.log('创建前=======')console.log(this.data)console.log(this.$el)},create
·
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../js/vue2.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<section id="app">
{{data}}
</section>
</body>
<script type="text/javascript">
var myVue = new Vue({
el:'#app',
data:{
data:'aaaa',
info:'nono'
},
beforeCreate:function(){
console.log('创建前=======')
console.log(this.data)
console.log(this.$el)
},
created:function(){
console.log('已创建==========')
console.log(this.info)
console.log(this.$el)
},
beforeMount:function(){
console.log('mount之前=============')
console.log(this.info)
console.log(this.$el)
},
mounted:function(){
console.log("mounted==========")
console.log(this.info)
console.log(this.$el)
},
beforeUpdate:function(){
console.log('更新前========')
},
updated:function(){
console.log('更新完成=============')
},
beforeDestory:function(){
console.log('销毁前============')
console.log(this.info)
console.log(this.$el)
},
destoryed:function(){
console.log('已销毁===========')
console.log(this.info)
console.log(this.$el)
}
});
</script>
</html>
更多推荐
已为社区贡献1条内容
所有评论(0)