我有一个产品模型,我想为每个产品添加一个图像,该图像将用于在产品详细信息页面中显示产品的图像。我希望我的用户能够使用域选择器驱动器文件夹中的驱动器选择器选择映像。我的产品模型中有一个ImageURL字段。
我的团队云端硬盘的“功能”属性设置为:SUPPORT_TEAM_DRIVES
我的驱动器选择器的“ onDocumentSelect”属性如下:
app.popups.ModalLoadingIndicator.visible = true;
var key = widget.datasource.item._key;
var id = result.docs[0].id;
google.script.run.withSuccessHandler(function() {
app.datasources.products.load(function() {
app.popups.ModalLoadingIndicator.visible = false;
});
}).autoAddimage(key, id);
是指此服务器脚本:
function autoAddimage(key, id) {
var record = app.models.products.getRecord(key);
record.imageID = id;
record.ImageUrl = Drive.Files.get(id).webContentLink;
app.saveRecords([record]);
}
由于某种原因,ImageUrl为空白。我尝试从个人驱动器文件夹和团队驱动器文件夹中选择图像,但它不起作用。我想实现的目标似乎非常简单,由于某种原因我无法弄清楚。