feat: 优化为先选择图片再裁剪

This commit is contained in:
2026-06-15 10:28:55 +08:00
parent 2ca7bb9817
commit 8ec0ad482b
2 changed files with 27 additions and 10 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
<template>
<s-pages title="裁剪头像" :purple_bg="true">
<view class="avatar-crop-page">
<avatarCropper @confirm="onConfirm" @error="onError" />
<avatarCropper :src="src" @confirm="onConfirm" @error="onError" />
<view v-if="uploading" class="loading-mask">
<view class="loading-box">上传中...</view>
</view>
@@ -16,10 +16,12 @@
import avatarCropper from '@/components/avatar_uploader/avatar_cropper.vue';
const { proxy } = getCurrentInstance();
const src = ref('');
const uploading = ref(false);
const eventChannel = ref(null);
onLoad(() => {
onLoad((options) => {
src.value = decodeURIComponent(String(options?.src || '').trim());
eventChannel.value = proxy.getOpenerEventChannel ? proxy.getOpenerEventChannel() : null;
});
@@ -102,4 +104,3 @@
font-size: 28rpx;
}
</style>