当前位置:网站首页>Wechat applet avatarcropper avatar clipping
Wechat applet avatarcropper avatar clipping
2022-07-26 09:27:00 【44w0】
Recently, I'm developing wechat applet , In order to avoid uploading too large user avatars , Lead to waste of resources , Added the function of head image clipping
Use u-View In the component library AvatarCropper Head cut
The official website has made it very clear , The following is the official website address :
https://www.uviewui.com/components/avatarCropper.html
I directly use the code on the official website , I found some problems :
this.$u.route Jump invalid , I'll switch to uniapp Of uni.navigateTo, change to the use of sth. uni.navigateTo You need to pay attention to , The original parameter writing method is not good ,uni.navigateTo The parameters of are spliced behind the path , Use... Between multiple parameters && separate .
methods{
chooseAvatar() {
uni.navigateTo({
// About this path , See below " matters needing attention "
url: '../../u-avatar-cropper/u-avatar-cropper?rectWidth='+200+'&&destWidth='+200+'&&fileType='+'jpg',
})
},
}
created() {
// Listen for events posted from the clipping page , Get clipping results
uni.$on('uAvatarCropper', path => {
let token = uni.getStorageSync("token");
this.avatar = path;
// You can upload it to the server here
uni.uploadFile({
url: baseUrl + '/users/updateAvatar', // Image upload address
filePath: path,
name: 'avatar',
header: {
Authorization: token
},
complete: (res) => {
console.log(res);
}
});
})
},
边栏推荐
- opencv图像处理
- WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
- Tornado multi process service
- 【Flutter -- 布局】Align、Center、Padding 使用详解
- Custom password input box, no rounded corners
- 服务器内存故障预测居然可以这样做!
- malloc分配空间失败,并且不返回null
- Cat installation and use
- mysql5.7.25主从复制(单向)
- Apple generated and verified tokens for PHP
猜你喜欢

mysql5.7.25主从复制(单向)

Under a directory of ext3 file system, subfolders cannot be created, but files can be created

arc-gis的基本使用2

Use of off heap memory

Zxing simplified version, reprinted

STM32+MFRC522完成IC卡号读取、密码修改、数据读写

volatile 靠的是MESI协议解决可见性问题?(上)

volatile 靠的是MESI协议解决可见性问题?(下)

Exception handling mechanism II
![[online problem] timeout waiting for connection from pool problem troubleshooting](/img/f0/7e8444ed7d0921b98d5e998e274bc8.png)
[online problem] timeout waiting for connection from pool problem troubleshooting
随机推荐
大二上第二周学习笔记
Fiddler下载安装
csdn空格用什么表示
wap端微信h5支付,用于非微信浏览器
ZXing简化版,转载
"No input file specified" problem handling
Fiddler抓包工具之移动端抓包
什么是异步操作
Voice chat app source code - Nath live broadcast system source code
大二上第一周学习笔记
神经网络与深度学习-6- 支持向量机1 -PyTorch
C# 托管与非托管
When you click input, the border is not displayed!
性格测试系统v1.0
JS output diamond on the console
Your login IP is not within the login mask configured by the administrator
面试题目大赏
OFDM Lecture 16 - OFDM
dll中的全局变量
安卓 实现缓存机制,多种数据类型缓存