mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-20 12:49:19 +08:00
feat(editor): 获取联动组件的方法函数中添加组件id参数
This commit is contained in:
parent
8142a7ab6d
commit
0196eb343a
@ -232,7 +232,7 @@ const compActionConfig = computed(() => {
|
||||
|
||||
let methods: EventOption[] | CascaderOption[] = [];
|
||||
|
||||
methods = eventsService.getMethod(node.type);
|
||||
methods = eventsService.getMethod(node.type, model.to);
|
||||
|
||||
if (node.type === 'page-fragment-container' && node.pageFragmentId) {
|
||||
const pageFragment = editorService.get('root')?.items?.find((page) => page.id === node.pageFragmentId);
|
||||
@ -240,7 +240,7 @@ const compActionConfig = computed(() => {
|
||||
methods = [];
|
||||
pageFragment.items.forEach((node: MComponent | MContainer) => {
|
||||
traverseNode<MComponent | MContainer>(node, (node) => {
|
||||
const nodeMethods = (node.type && eventsService.getMethod(node.type)) || [];
|
||||
const nodeMethods = (node.type && eventsService.getMethod(node.type, node.id)) || [];
|
||||
|
||||
if (nodeMethods.length) {
|
||||
methods.push({
|
||||
@ -317,7 +317,7 @@ const tableConfig = computed(() => ({
|
||||
const node = editorService.getNodeById(model.to);
|
||||
if (!node?.type) return [];
|
||||
|
||||
return eventsService.getMethod(node.type).map((option: any) => ({
|
||||
return eventsService.getMethod(node.type, model.to).map((option: any) => ({
|
||||
text: option.label,
|
||||
value: option.value,
|
||||
}));
|
||||
|
@ -20,7 +20,7 @@ import { reactive } from 'vue';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import type { Writable } from 'type-fest';
|
||||
|
||||
import { type EventOption } from '@tmagic/core';
|
||||
import { type EventOption, type Id } from '@tmagic/core';
|
||||
import { toLine } from '@tmagic/utils';
|
||||
|
||||
import type { AsyncHookPlugin, SyncHookPlugin } from '@editor/type';
|
||||
@ -70,7 +70,7 @@ class Events extends BaseService {
|
||||
methodMap[toLine(type)] = [...method];
|
||||
}
|
||||
|
||||
public getMethod(type: string) {
|
||||
public getMethod(type: string, _targetId: Id) {
|
||||
return cloneDeep(methodMap[toLine(type)]) || [];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user