diff --git a/src/components/spray/sprayParams/index.vue b/src/components/spray/sprayParams/index.vue
index 970f5a3..010e2b0 100644
--- a/src/components/spray/sprayParams/index.vue
+++ b/src/components/spray/sprayParams/index.vue
@@ -178,16 +178,22 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
}, 100)
}
+const swiperKey = ref(1)
const matrixCraftChange = async (id: number) => {
loading.value = true
form.value = await getCraftById(id)
- console.log(form.value)
- await nextTick(() => {
- form.value.times?.forEach((item: any, index: number) => {
- sprayRefs.value[index].updateSelection(item.x1 * 5, item.y1 * 5, (item.x2 - item.x1) * 5, (item.y2 - item.y1) * 5)
+ swiperInstance?.update()
+ swiperKey.value++
+
+ setTimeout(() => {
+ nextTick(() => {
+ form.value.times?.forEach((item: any, index: number) => {
+ console.log(item)
+ sprayRefs.value[index].updateSelection(item.x1 * 5, item.y1 * 5, (item.x2 - item.x1) * 5, (item.y2 - item.y1) * 5)
+ })
+ loading.value = false
})
- loading.value = false
- })
+ }, 0)
}
const onSlideChange = (swiper: any) => {
@@ -249,6 +255,7 @@ const touchendHandle = () => {
{
// 新增方法:更新矩形选区位置
const updateSelection = (x: number, y: number, width: number, height: number) => {
if (rect.value) {
+ console.log(x, y, width, height)
rect.value.position({ x, y })
rect.value.width(width)
rect.value.height(height)
newWidth = width
newHeight = height
+ rect.value.clearCache()
layer.value.draw()
}
}