diff --git a/pages/API/unicloud-file-api/unicloud-file-api.uvue b/pages/API/unicloud-file-api/unicloud-file-api.uvue index 838a58164cde043b9c234a890e73dc043819a567..d6a3218713ed138c8c7c25fa9d8beb7ea060888b 100644 --- a/pages/API/unicloud-file-api/unicloud-file-api.uvue +++ b/pages/API/unicloud-file-api/unicloud-file-api.uvue @@ -7,6 +7,7 @@ + @@ -62,6 +63,26 @@ console.error('chooseImage fail: ', err) } }) + }, + chooseAndUploadFile() { + uniCloud.chooseAndUploadFile({ + type: 'image' + }).then(function (res) { + uni.hideLoading() + console.log(res) + uni.showModal({ + content: '上传成功', + showCancel: false + }); + }) + .catch(function (err : any | null) { + uni.hideLoading() + const error = err as UniCloudError + uni.showModal({ + content: '上传失败,' + error.errMsg, + showCancel: false + }); + }) } } }