Browse Source

fix: 喷涂区域: 删除tab后区域没有更新

master
guoapeng 3 weeks ago
parent
commit
f0af81b920
  1. 3
      src/components/martixCraft/Edit/index.vue
  2. 2
      src/components/spray/sprayParams/index.vue
  3. 3
      src/components/spray/trayGraph/index.vue

3
src/components/martixCraft/Edit/index.vue

@ -128,6 +128,7 @@ const cancel = () => {
const sprayRefs = ref<any>([]) const sprayRefs = ref<any>([])
const activeTab = ref(0) const activeTab = ref(0)
const swiperKey = ref(1)
const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => { const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => {
if (action === 'add') { if (action === 'add') {
if (form.value.times.length >= 10) { if (form.value.times.length >= 10) {
@ -153,6 +154,7 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
} }
form.value.times.splice(activeTab.value, 1) form.value.times.splice(activeTab.value, 1)
} }
swiperKey.value++
// //
setTimeout(() => { setTimeout(() => {
@ -220,6 +222,7 @@ const touchendHandle = () => {
<el-tab-pane v-for="(item, index) in form.times" :key="index" :label="`第${index + 1}次`" :name="index" /> <el-tab-pane v-for="(item, index) in form.times" :key="index" :label="`第${index + 1}次`" :name="index" />
</el-tabs> </el-tabs>
<Swiper <Swiper
:key="swiperKey"
:modules="[Pagination, Navigation]" :modules="[Pagination, Navigation]"
:pagination="{ clickable: true }" :pagination="{ clickable: true }"
:navigation="true" :navigation="true"

2
src/components/spray/sprayParams/index.vue

@ -170,7 +170,7 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
} }
form.value.times.splice(activeTab.value, 1) form.value.times.splice(activeTab.value, 1)
} }
swiperKey.value++
// //
setTimeout(() => { setTimeout(() => {
swiperInstance?.slideTo(activeTab.value) swiperInstance?.slideTo(activeTab.value)

3
src/components/spray/trayGraph/index.vue

@ -178,7 +178,6 @@ const addGuideLine = () => {
const getSelection = () => { const getSelection = () => {
if (rect.value) { if (rect.value) {
const pos = rect.value.position() const pos = rect.value.position()
console.log(newWidth, newHeight)
return { return {
x1: formatNum(pos.x / zoom), x1: formatNum(pos.x / zoom),
y1: formatNum(pos.y / zoom), y1: formatNum(pos.y / zoom),
@ -192,7 +191,6 @@ const getSelection = () => {
// //
const updateSelection = (x: number, y: number, width: number, height: number) => { const updateSelection = (x: number, y: number, width: number, height: number) => {
if (rect.value) { if (rect.value) {
console.log(x, y, width, height)
rect.value.position({ x, y }) rect.value.position({ x, y })
rect.value.width(width) rect.value.width(width)
rect.value.height(height) rect.value.height(height)
@ -229,7 +227,6 @@ const updateLine = (point: { x: number, y: number }, index: number, stroke: stri
} }
nextTick(() => { nextTick(() => {
const currentLine = lines.value[index] const currentLine = lines.value[index]
console.log(currentLine, currentLine.points())
currentLine.points([...currentLine.points(), point.x, point.y]) currentLine.points([...currentLine.points(), point.x, point.y])
currentLine.getLayer()!.batchDraw() // currentLine.getLayer()!.batchDraw() //
}) })

Loading…
Cancel
Save