猿问

vue watch竟然比created先执行吗?要怎么办

watch: {

activeTab: {
  handler: function (val, oldVal) {    if (val === '1') {      this._getPayBillHouseList()
    } else {      this._getAppReceiveBillList()
    }
  },
  immediate: true}

}
created () {

this.hourseId = this.$route.params.id

},
methods: {

async _getPayBillHouseList () {  let result = await getPayBillHouseList(this.hourseId)  this.payArr = result.rData
},async _getAppReceiveBillList () {  let result = await getAppReceiveBillList(this.hourseId)  this.overPayArr = result.rData
}

},


慕神8447489
浏览 4058回答 1
1回答

小唯快跑啊

在created里面再进行watchthis.$watch('activeTab', (val, oldVal) => {    if (val === '1') {      this._getPayBillHouseList()     } else {      this._getAppReceiveBillList()     }   })
随时随地看视频慕课网APP

相关分类

Vue.js
我要回答