[英]sailsjs standalone action to view (Sailsjs V1.0.0)
I have a standalone action which I call from my front end via a button click using CloudSDK, I get my value but the action does not redirect to the view. 我有一个独立的动作,我通过按钮点击使用CloudSDK从我的前端调用,我得到了我的值,但操作不会重定向到视图。 I have specified the responseType as view in my success exit but this does not seem to work.
我已在成功退出时将responseType指定为视图,但这似乎不起作用。
Button code in page.js file: page.js文件中的按钮代码:
clickVerifyBtn: async function(uid) {
await Cloud.userIdVerify(uid);
},
the action 那个行动
module.exports = {
friendlyName: 'User id verify',
description: '',
inputs: {
uid: {
description: 'Id of the user',
type: 'number'
},
},
exits: {
success:{
responseType: 'view',
viewTemplatePath: 'pages/admin/verification-doc',
}
},
fn: async function (inputs, exits) {
// All done.
var userdoc = await Photo.findOne({ownerId: inputs.uid, isRemoved:false, photoType:0})
var imageSrc = '/images/useruploads/'+userdoc.imageFileName;
return exits.success({imageSrc: imageSrc});
}
};
What is the correct way to achieve this ? 实现这一目标的正确方法是什么? Should I submitting my value to the action via the ajax-form component bundled in Sails?
我应该通过捆绑在Sails中的ajax-form组件将我的值提交给操作吗?
Any help is greatly appreciated. 任何帮助是极大的赞赏。
action2不是直接将变量返回给视图,而是返回视图的页面实例(your_view.page.js)提交的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.