修复第7条需求:确保拖动Panel标题栏能移动Area
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user