Merge branch 'main' of http://123.132.248.154:10000/gitY/LinYeFangHuo
commit
5dbcd6b97d
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue