修复第7条需求:确保拖动Panel标题栏能移动Area

This commit is contained in:
zqm
2025-11-04 14:34:40 +08:00
parent d9cd0518ca
commit 6c724b5903
3 changed files with 30 additions and 5 deletions

View File

@@ -58,7 +58,7 @@
</template>
<script setup>
import { defineProps, computed, defineEmits, ref, onMounted } from 'vue'
import { defineProps, computed, defineEmits, ref, onMounted, watch } from 'vue'
const props = defineProps({
id: { type: String, required: true },
@@ -99,6 +99,19 @@ const parentContainer = ref(null)
// 根据本地状态计算是否最大化
const isMaximized = computed(() => localState.value === '最大化' || localState.value === 'maximized')
// 监听props位置变化更新原始位置
watch(() => props.left, (newLeft) => {
if (newLeft !== undefined && newLeft !== originalPosition.value.left) {
originalPosition.value.left = newLeft
}
}, { immediate: true })
watch(() => props.top, (newTop) => {
if (newTop !== undefined && newTop !== originalPosition.value.top) {
originalPosition.value.top = newTop
}
}, { immediate: true })
// 根据状态计算尺寸和位置样式
const areaStyle = computed(() => {
if (isMaximized.value) {