Vue2.0 - 生命周期
2024-09-29 10:24:07
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="../assets/js/vue.js"></script>
<title>构造器的声明周期</title>
</head>
<body>
<h1>构造器的声明周期</h1>
<hr>
<div id="app">
{{message}}
<p><button @click="jia">加分</button></p>
</div>
<button onclick="app.$destroy()">销毁</button>
<script type="text/javascript">
var app=new Vue({
el:'#app',
data:{
message:1
},
methods:{
jia:function(){
this.message ++;
}
},
beforeCreate:function(){
console.log('1-beforeCreate 初始化之后');
},
created:function(){
console.log('2-created 创建完成');
},
beforeMount:function(){
console.log('3-beforeMount 挂载之前');
},
mounted:function(){
console.log('4-mounted 被创建');
},
beforeUpdate:function(){
console.log('5-beforeUpdate 数据更新前');
},
updated:function(){
console.log('6-updated 被更新后');
},
activated:function(){
console.log('7-activated');
},
deactivated:function(){
console.log('8-deactivated');
},
beforeDestroy:function(){
console.log('9-beforeDestroy 销毁之前');
},
destroyed:function(){
console.log('10-destroyed 销毁之后')
}
})
</script>
</body>
</html>
最新文章
- [BZOJ3211]花神游历各国(线段树+区间开根)
- 侧滑菜单SlidingMenu
- QT 信号与槽connect
- [转] PHP计算两个坐标之间的距离, Calculate the Distance Between Two Points in PHP
- Eclipse中为自己写完的函数添加注释(快捷键ALT+SHIFT+J)
- Elasticsearch 相关名词理解
- BZOJ 2054 疯狂的馒头
- CSS 实现:两栏布局(一边固定,一边自适应)
- JS通用方法总结(一)
- Some_problem_with_octopress
- <;转载>;DIV+CSS position定位方法总结
- 整理了一份React-Native学习指南
- LeetCode-Best Time to Buy and Sell Stock III[dp]
- VS2005工程的Device右边内容为空问题
- Android开发学习总结(二)——使用Android Studio搭建Android集成开发环境
- 防止xss攻击。
- Cocos Creator 计时器的延时循环试用方法
- CS229 6.13 Neurons Networks Implements of stack autoencoder
- ActiveMQ实战之 Queue点对点消息
- 【转】mybatis连接Oracle做增删改查