Vue週期

技術分享

 

關於開始beforeCreate前調取data數據:javascript

var vm = new Vue({
  el: '#app',
  data() {
    return {
      message: "你好呀!"
    }
  },
  beforeCreate() {
    this.$nextTick(function () {
      console.log(this.message);
    })
  }
});

參考示例:在 this.$nextTick回調函數中獲取html

 

參考文檔:

1.Vue實例的生命週期全過程(圖):http://www.mamicode.com/info-detail-1908811.htmlvue

2.vue怎麼在beforeCreate裏獲取data:https://segmentfault.com/q/1010000012331476/a-1020000012643032java

相關文章
相關標籤/搜索