zoukankan      html  css  js  c++  java
  • Vue2.0 生命周期

    <!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>
  • 相关阅读:
    SQL Server 快速大数据排序方法
    RGB颜色名称与色值对应表
    Visual Studio 2017 Android 调试无法连接到虚拟机
    sqlite 使用 cte 及 递归的实现示例
    C# 判断文件编码
    SQL点点滴滴_SQL分页查询
    SQL点点滴滴_判断字段或者字符中是否包含有特殊字符
    SQL点点滴滴_公用表表达式(CTE)递归的生成帮助数据
    【Oracle】Update方法
    SQL点点滴滴_DELETE小计
  • 原文地址:https://www.cnblogs.com/zccblog/p/7192450.html
Copyright © 2011-2022 走看看