這個是elementUI的tree控件被選上的值是后臺傳給我的//mounted生命中期中的代碼:
axios.get('/adSquad/findById',{
params:{
id:this.currentID
}
})
.then(res=>{ this.$refs.tree_Interests.setCheckedKeys(res.data.data.interest); //設置被選中
}
})瀏覽器提示了:'setCheckedKeys' of undefined想了下,應該是生命周期的問題。tree控件還沒加載出來就被賦值了,就會提示undefined。所以有沒有方法等頁面加載完成后去請求后臺數據?
關于vue的生命周期
青春有我
2018-06-26 14:30:24