2024-07-07
编程与技术
00

简介

本文记录使用Uniapp开发小程序时,如何实现一个文件(图片)上传的功能,并且将图片上传至阿里云OSS。

基于Vue3

选择图片

ts
const selectImage = () => { uni.chooseImage({ count: 1, sizeType: ["compressed"], success: (file) => { console.log(file); getSignature("avatar").then((sign) => { // console.log(sign); const newName = getNewFilename(file.tempFilePaths[0]); // console.log(newName); uploadImage(sign, newName, file.tempFilePaths[0]).then((res) => { // console.log(res); imageStr.value = `${sign.host}/${sign.dir}/${newName}`; info.value.avatarUrl = `${sign.host}/${sign.dir}/${newName}`; }); }); }, }); };
2024-07-07
美图鉴赏
00
2024-07-05
美图鉴赏
00
2024-07-04
美图鉴赏
00

原推主:https://x.com/Murata_san_

本贴所有图片均来自原推主。原神启动!

image

2024-07-03
美图鉴赏
00