userName 2025-03-04 17:03:58 +08:00
commit 5dbcd6b97d
1 changed files with 52 additions and 1 deletions

View File

@ -1,5 +1,12 @@
<template>
<div class="title">
<div
class="title"
@click="clickBtn"
@dblclick="dblclickBtn"
@contextmenu="rightclickBtn"
@mouseenter="mouseenterBtn"
@mouseleave="mouseleaveBtn"
>
<n-image :width="w" :height="h" :src="option.dataset" preview-disabled />
<span class="Tupian">
<Tupian :w="w" :h="h" />
@ -14,8 +21,10 @@
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
import { useChartDataFetch } from '@/hooks';
import Tupian from './svg/tupian.vue';
import { eventHandlerHook } from '@/hooks/eventHandler.hook';
import { EventBus } from '@/utils/eventBus';
const chartEditStore = useChartEditStore();
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
@ -27,6 +36,47 @@
const option = reactive({
dataset: props.chartConfig.option.dataset,
});
const clickBtn = (val) => {
eventHandlerHook(
chartEditStore.getComponentList,
props.chartConfig.events.interactConfigEvents,
'click',
val,
);
};
const dblclickBtn = (val) => {
eventHandlerHook(
chartEditStore.getComponentList,
props.chartConfig.events.interactConfigEvents,
'dblclick',
val,
);
};
const rightclickBtn = (event) => {
event.preventDefault(); //
eventHandlerHook(
chartEditStore.getComponentList,
props.chartConfig.events.interactConfigEvents,
'rightclick',
);
};
const mouseenterBtn = (val) => {
eventHandlerHook(
chartEditStore.getComponentList,
props.chartConfig.events.interactConfigEvents,
'mousein',
val,
);
};
const mouseleaveBtn = (val) => {
eventHandlerHook(
chartEditStore.getComponentList,
props.chartConfig.events.interactConfigEvents,
'mouseout',
val,
);
};
onMounted(() => {
// eventBus
EventBus.on(props.chartConfig.id + 'click', (data) => {
@ -39,6 +89,7 @@
.title {
width: v-bind('`${w}px`');
height: v-bind('`${h}px`');
cursor: pointer;
}
.Tupian {
position: absolute;