<u-button size="mini"style="background-color: #3ac908;color: #ffffff;font-size: 16rpx;width: 110rpx;height: 50rpx;" @tap="onUpload">上传</u-button>
onUpload(id) {//文件上传 let user_id = uni.getStorageSync('user_id') this.$refs.lFile.upload({ url: 'xxx',//替换成你自己的上传地址 name: 'file', header: {//请求头 'Authorization': 'bearer eyJhbGciOiJSUzI1NiIsIn', 'uid': '27682', 'client': 'app', }, maxSize: 100,//现在文件大小 user_id, mode: 1, group_id: id }); }, onSuccess(res) { console.log('上传成功回调', JSON.stringify(res)); uni.showToast({ title: "上传成功", icon: 'none' }) },
// 以下代码写于根目录下第一个view顶部或跟在自定义导航栏后面 <l-file ref="lFile" @up-success="upSuccess" ></l-file>
标签:uniapp,插件,自定义,app,user,上传,id From: https://www.cnblogs.com/lyq1714/p/17676754.html