tiny-vue/examples/sites/demos/pc/app/process-designer/events-composition-api.vue

22 lines
580 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<tiny-process-designer :height="480" @element.click="onElementClick" @selection.changed="onSelectionChanged" />
<p>当前选中{{ selectedId || '无' }}</p>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { TinyProcessDesigner } from '@opentiny/vue'
const selectedId = ref('')
const onElementClick = (event) => {
selectedId.value = event && event.element ? event.element.id : ''
}
const onSelectionChanged = ({ newSelection }) => {
selectedId.value = newSelection && newSelection[0] ? newSelection[0].id : ''
}
</script>