簡體   English   中英

如何從 Laravue 中的其他文件請求響應中獲取響應

[英]How to get response from other file request response in Laravue

我正在嘗試從 File2.vue 獲取響應並傳回 File1.vue。 我正在使用 VueJS v1.0.28,如何從其他文件請求響應中獲取響應?

文件1.vue

   File2.updateNotice(this,{'id':id}).then((response) => {
      console.log("response from File2  :",response)
   }); 

文件2.vue

updateNotice(context,params) {
            let url = staff_service.STAFF_NOTICES_READ_RESOURCE;
            Vue.http.post(
                url,
                params
            ).then(response => {
                return response;
            }) 
}

來自 File1 的錯誤響應:

Cannot read property 'then' of undefined

現在解決了,添加了一個

返回

Vue.http.post(

File2.vue

文件1.vue

   File2.updateNotice(this,{'id':id}).then((response) => {
      console.log("response from File2  :",response)
   }); 

文件2.vue

updateNotice(context,params) {
            let url = staff_service.STAFF_NOTICES_READ_RESOURCE;
            return Vue.http.post(
                url,
                params
            ).then(response => {
                return response;
            }) 
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM