refactor(editor): Migrate small components to composition API (#11509)

This commit is contained in:
Ricardo Espinoza
2024-11-04 08:06:00 -05:00
committed by GitHub
parent 5e2e205394
commit 23677062d9
12 changed files with 372 additions and 470 deletions

View File

@@ -1,32 +1,29 @@
<script lang="ts">
import { defineComponent } from 'vue';
<script setup lang="ts">
import Draggable from './Draggable.vue';
import type { XYPosition } from '@/Interface';
export default defineComponent({
components: {
Draggable,
},
props: {
canMoveRight: {
type: Boolean,
},
canMoveLeft: {
type: Boolean,
},
},
methods: {
onDrag(e: XYPosition) {
this.$emit('drag', e);
},
onDragStart() {
this.$emit('dragstart');
},
onDragEnd() {
this.$emit('dragend');
},
},
});
defineProps<{
canMoveRight: boolean;
canMoveLeft: boolean;
}>();
const emit = defineEmits<{
drag: [e: XYPosition];
dragstart: [];
dragend: [];
}>();
const onDrag = (e: XYPosition) => {
emit('drag', e);
};
const onDragEnd = () => {
emit('dragend');
};
const onDragStart = () => {
emit('dragstart');
};
</script>
<template>