修改自定义的监听逻辑

v1.2.0
于肖磊 2025-02-19 14:57:57 +08:00
parent 6dc06dd9ed
commit 3c4dd2a62e
1 changed files with 7 additions and 1 deletions

View File

@ -11,10 +11,16 @@
</template>
<script lang="ts" setup>
const data_location = defineModel({ type: Object, default: () => ({ x: 0, y: 0 }) });
const data_location = defineModel({ type: Object, default: () => ({ x: 0, y: 0, staging_y: 0 }) });
const emit = defineEmits(['operation_end']);
//
const operation_end = () => {
emit('operation_end');
};
// y
watch(() => data_location.value.y, (val) => {
if (val !== data_location.value.staging_y) {
data_location.value.staging_y = val;
}
});
</script>