同步处理获取返回值
async queryContent(id){
let param = {id:id}
let res = await getNoticeContent(param)
return new Promise(resolve => {
if (res && res.code == 200) {
resolve(res.data == null?'':res.data);
} else {
resolve("")
}
});
},
返回后在本方法里边设置参数
const noticeContent = await this.queryContent(row.id)
this.$set(this.form, "noticeContent", noticeContent)
或者使用(在方法里边设置值)
async queryContent(id){
let param = {id:id}
let res = await getNoticeContent(param)
let _self = this
return new Promise(resolve => {
if (res) {
if (res && res.code == 200) {
_self.$set(_self.form, "noticeContent", res.data == null?'':res.data)
} else {
_self.$set(_self.form, "noticeContent", "")
}
resolve();
}
});
},