重绘重排 中重复出现的是

mounted(){...}

beforeUpdate(){...}

uptated(){...}

其他钩子函数只会出现一次

  • <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>viewModel 的生命周期</title>
    <link rel="stylesheet" type="text/css" href="./css/index.css">
    </head>
    <body>
    <div id="test">
    <button type="button" @click="destroyVue">卸载 viewModel</button>
    <p v-show="isShow">生当作人杰,死亦为鬼雄。</p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
    new Vue({
    el: "#test",
    data:{
    isShow: true
    },
    methods:{
    destroyVue(){
    this.$destroy();
    }
    },
    mounted(){ // 初始显示之后立即执行: 执行异步任务
    this.timerId = window.setInterval(()=>{
    console.log("27 ---- mounted");
    this.isShow = !this.isShow
    }, 1000)
    },
    beforeDestroy(){
    console.log("32 ---- beforeDestroy");
    window.clearInterval(this.timerId)
    },
    /****************************************************************************/
    beforeCreate(){
    console.log("36 beforeCreate")
    },
    created(){
    console.log("40 createdcreated")
    },
    beforeMount(){
    console.log("42 beforeMount")
    },
    beforeUpdate(){
    console.log("46 beforeUpdate")
    },
    updated(){
    console.log("49 updated")
    },
    destroyed(){
    console.log("52 destoryed")
    }
    })
    </script>
    </body>
    </html>

最新文章

  1. SVN源代码的版本控制系统使用简介
  2. python初识生成器 迭代器
  3. 十大关系数据库SQL注入工具一览
  4. Visual studio 2013安装及单元测试
  5. ContentProvider 使用示例(转载)
  6. andirod
  7. TMsgThread, TCommThread -- 在delphi线程中实现消息循环
  8. ubuntu下boost的配置方法
  9. linux(centos)搭建svn
  10. 使用 IDEA 创建 Maven Web 项目 (二)- 搭建 WEB 项目框架
  11. tomcat解压版安装(摘自网络)
  12. 全栈必备 JavaScript基础
  13. 从壹开始微服务 [ DDD ] 之五 ║聚合:实体与值对象 (上)
  14. 洛谷P1036选数(素数+组合数)
  15. react的Virtual DOM
  16. 7 种 join
  17. Openssl与私有CA搭建
  18. dedecms利用addfields body在首页调用文章内容
  19. Management Studio 插件生成安装包要点(以ProjkyAddin为例)
  20. Laya 1.x 按文件夹TS代码合并

热门文章

  1. SPFA+SLF+LLL
  2. MongoDB实战性能优化
  3. CSS盒模型深入理解
  4. [数学笔记Mathematical Notes]2-一个带对数的积分不等式
  5. python学习02
  6. Sql server not in优化
  7. Coursera, Big Data 2, Modeling and Management Systems (week 4/5/6)
  8. 【Java编程思想笔记】注解--元注解
  9. 分布式系列七: zookeeper简单用法
  10. windows系统上安装mysql操作过程及常见错误处理