繁体   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