Vue实例生命周期以及图示

版权声明: https://blog.csdn.net/xyphf/article/details/83654797
<body>
  <div id="app"></div>

  <script>
    var vm = new Vue({
      el: '#app',
      template: "<div>hello world</div>"
      data: {
        test: 'hello world'
      },
      beforeCreate: function() {
        console.log("beforeCreate");
      },
      created: function() {
        console.log("created");
      },
      beforeMount: function() {
        console.log(this.$el);
        console.log("beforeMount");
      },
      mounted: function() {
        console.log(this.$el);
        console.log("mounted");
      },
      beforeDestroy: function() {
        console.log("beforeDestroy");
      },
      destroyed: function() {
        console.log("destroyed");
      },
      beforeUpdate: function() {
        console.log("beforeUpdate");
      },
      updated: function() {
        console.log("updated");
      }
    })
  </script>
<body>

猜你喜欢

转载自blog.csdn.net/xyphf/article/details/83654797