From 84a85473358ea9b0b968933ab6674e1852dafb4a Mon Sep 17 00:00:00 2001 From: chilingling Date: Mon, 26 Aug 2024 05:25:01 -0700 Subject: [PATCH 1/3] fix: switch selected component event name list still show the origin one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复画布切换选择组件后,高级面板事件列表仍然显示原组件事件列表的bug close #747 --- .../settings/events/src/components/BindEvents.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/settings/events/src/components/BindEvents.vue b/packages/settings/events/src/components/BindEvents.vue index aa8550f251..1a54dbaf72 100644 --- a/packages/settings/events/src/components/BindEvents.vue +++ b/packages/settings/events/src/components/BindEvents.vue @@ -28,7 +28,7 @@ @@ -43,7 +43,7 @@
- {{ action.eventName }}{{ renderEventList[action.eventName]?.label?.zh_CN }} + {{ action.eventName }}{{ renderEventList[action.eventName]?.label?.[locale] }}
{{ action.linkedEventName }}
{{ action.ref }} @@ -88,6 +88,7 @@ import { computed, reactive, watchEffect } from 'vue' import { Popover, Button } from '@opentiny/vue' import { useCanvas, useModal, useLayout, useBlock, useResource } from '@opentiny/tiny-engine-controller' +import i18n from '@opentiny/tiny-engine-controller/js/i18n' import { BlockLinkEvent, SvgButton } from '@opentiny/tiny-engine-common' import { iconHelpQuery, iconChevronDown } from '@opentiny/vue-icon' import BindEventsDialog, { open as openDialog } from './BindEventsDialog.vue' @@ -112,6 +113,7 @@ export default { const { getBlockEvents, getCurrentBlock, removeEventLink } = useBlock() const { getMaterial } = useResource() const { confirm } = useModal() + const locale = i18n.global.locale.value const { highlightMethod } = getPluginApi(PLUGIN_NAME.PageController) @@ -119,14 +121,14 @@ export default { eventName: '', // 事件名称 eventBinding: null, // 事件绑定的处理方法对象 componentEvent: {}, - componentEvents: commonEvents, + customEvents: commonEvents, bindActions: {}, showBindEventDialog: false }) const isBlock = computed(() => Boolean(pageState.isBlock)) const isEmpty = computed(() => Object.keys(state.bindActions).length === 0) - const renderEventList = computed(() => ({ ...state.componentEvent, ...state.componentEvents })) + const renderEventList = computed(() => ({ ...state.componentEvent, ...state.customEvents })) watchEffect(() => { const componentName = pageState?.currentSchema?.componentName @@ -225,7 +227,7 @@ export default { const handleAddEvent = (params) => { const { eventName, eventDescription } = params - Object.assign(state.componentEvents, { + Object.assign(state.customEvents, { [eventName]: { label: { zh_CN: eventDescription @@ -254,7 +256,8 @@ export default { openActionDialog, handleAddEvent, handleToggleAddEventDialog, - renderEventList + renderEventList, + locale } } }