1、牢牢記住,vue是基于JavaScript ES6的,所以只要刷新頁(yè)面里面data下的數(shù)據(jù),頁(yè)面會(huì)自動(dòng)刷新的。
所以這個(gè)數(shù)據(jù)是父頁(yè)面?zhèn)鹘oel-dialog的,要刷新父頁(yè)面的數(shù)據(jù),el-dialog頁(yè)面內(nèi)的組件就可以刷新了。
2、在頁(yè)面的組件處理后臺(tái)程序完成后,可以調(diào)用
that.$parent.$parent.【父頁(yè)面的方法】
來刷新數(shù)據(jù)。例如:文章來源:http://www.zghlxwxcb.cn/news/detail-548788.html
monitorDataService.saveFileToMonitor({
updateFile:that.updateFile,
monitorId:that.form.monitorId
}).then(response=>{
//完成后刷新
if(response.code==200){
that.$parent.$parent.getMonitorDataInfo(that.form.monitorId);
}
});
其中,文章來源地址http://www.zghlxwxcb.cn/news/detail-548788.html
that.$parent.$parent.getMonitorDataInfo就是父頁(yè)面寫在
methods:{}
里面的一個(gè)方法。它的主要作用就是從服務(wù)器獲取數(shù)據(jù)然后將數(shù)據(jù)保存到當(dāng)前頁(yè)面的data中相對(duì)應(yīng)的變量中。這些變量改變,組件里面的watch就可以監(jiān)聽到
到了這里,關(guān)于element UI組件庫(kù)el-dialog內(nèi)程序刷新el-dialog內(nèi)組件方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!