attachment(非attachmentSimple)组件上默认有下载和预览,如果要自己实现,可以获取附件关系中存储的json信息然后调用平台的api实现
获取json串中的信息参考链接中
下载的API如下:
DocUtils.InnerUtils.downloadDocByFileID({
docPath:docPath,
fileID:fileID,
context:this.getContext()
});
预览的API如下:
DocUtils.InnerUtils.getdocServerAction({
"docPath" : docPath,
urlPattern : "/repository/file/view/" + fileID + "/last/content",
isFormAction : false,
context : this.getContext()
});
其中的docPath和fileID就是需要从json串中获取的
注意调用API需要先引用
DocUtils = require('$UI/system/components/justep/docCommon/docUtil');
评一波