|
@@ -84,7 +84,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { computed, ref, watch } from 'vue';
|
|
|
|
|
|
|
+import { computed, nextTick, ref, watch } from 'vue';
|
|
|
import { Popup, Swipe, SwipeItem } from 'vant';
|
|
import { Popup, Swipe, SwipeItem } from 'vant';
|
|
|
import { ArrowLeftBold, ArrowRightBold, EditPen } from '@element-plus/icons-vue';
|
|
import { ArrowLeftBold, ArrowRightBold, EditPen } from '@element-plus/icons-vue';
|
|
|
|
|
|
|
@@ -160,12 +160,14 @@ const currentRemark = computed(() => {
|
|
|
|
|
|
|
|
watch(
|
|
watch(
|
|
|
() => [props.show, props.startIndex, props.images],
|
|
() => [props.show, props.startIndex, props.images],
|
|
|
- ([show, start]) => {
|
|
|
|
|
|
|
+ async ([show, start]) => {
|
|
|
if (!show) return;
|
|
if (!show) return;
|
|
|
const lastIndex = Math.max(normalizedImages.value.length - 1, 0);
|
|
const lastIndex = Math.max(normalizedImages.value.length - 1, 0);
|
|
|
const normalizedIndex = Math.min(Math.max(start || 0, 0), lastIndex);
|
|
const normalizedIndex = Math.min(Math.max(start || 0, 0), lastIndex);
|
|
|
activeIndex.value = normalizedIndex;
|
|
activeIndex.value = normalizedIndex;
|
|
|
remarkDraftMap.value = {};
|
|
remarkDraftMap.value = {};
|
|
|
|
|
+ // 首次打开时 Popup 懒渲染,Swipe 还没挂载,需等一帧再定位
|
|
|
|
|
+ await nextTick();
|
|
|
previewSwipeRef.value?.swipeTo(activeIndex.value);
|
|
previewSwipeRef.value?.swipeTo(activeIndex.value);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|