style(playground): 完善ts定义

This commit is contained in:
roymondchen 2024-07-25 17:51:49 +08:00
parent 0bbf7c5643
commit ea556d69f6
2 changed files with 16 additions and 12 deletions

View File

@ -16,11 +16,12 @@
* limitations under the License. * limitations under the License.
*/ */
// @ts-nocheck import { ActionType, type MApp, NodeType } from '@tmagic/schema';
export default {
id: '75f0extui9d7yksklx27hff8xg', const dsl: MApp = {
id: '1',
name: 'test', name: 'test',
type: 'app', type: NodeType.ROOT,
codeBlocks: { codeBlocks: {
code_5336: { code_5336: {
name: 'getData', name: 'getData',
@ -50,7 +51,7 @@ export default {
}, },
items: [ items: [
{ {
type: 'page', type: NodeType.PAGE,
id: 'page_299', id: 'page_299',
name: 'index', name: 'index',
title: '', title: '',
@ -76,7 +77,7 @@ export default {
name: 'magic:common:events:click', // 事件名 name: 'magic:common:events:click', // 事件名
actions: [ actions: [
{ {
actionType: 'code', // 联动动作类型 actionType: ActionType.CODE, // 联动动作类型
codeId: 'code_5336', // 代码块id codeId: 'code_5336', // 代码块id
params: { params: {
age: 12, // 参数 age: 12, // 参数
@ -88,7 +89,7 @@ export default {
name: 'magic:common:events:click', // 事件名 name: 'magic:common:events:click', // 事件名
actions: [ actions: [
{ {
actionType: 'code', // 联动动作类型 actionType: ActionType.CODE, // 联动动作类型
codeId: 'code_5316', // 代码块id codeId: 'code_5316', // 代码块id
params: {}, params: {},
}, },
@ -220,7 +221,7 @@ export default {
name: 'magic:common:events:click', name: 'magic:common:events:click',
actions: [ actions: [
{ {
actionType: 'comp', actionType: ActionType.COMP,
to: 'overlay_2159', to: 'overlay_2159',
method: 'openOverlay', method: 'openOverlay',
}, },
@ -421,7 +422,7 @@ export default {
}, },
], ],
methods: [], methods: [],
events: '', events: [],
mocks: [], mocks: [],
beforeRequest: '', beforeRequest: '',
afterResponse: '', afterResponse: '',
@ -456,7 +457,7 @@ export default {
}, },
}, },
], ],
events: '', events: [],
mocks: [], mocks: [],
beforeRequest: '', beforeRequest: '',
afterResponse: '', afterResponse: '',
@ -471,3 +472,5 @@ export default {
}, },
}, },
}; };
export default dsl;

View File

@ -59,7 +59,7 @@ import {
type Services, type Services,
TMagicEditor, TMagicEditor,
} from '@tmagic/editor'; } from '@tmagic/editor';
import type { MContainer, MNode } from '@tmagic/schema'; import type { MApp, MContainer, MNode } from '@tmagic/schema';
import { NodeType } from '@tmagic/schema'; import { NodeType } from '@tmagic/schema';
import type { CustomizeMoveableOptionsCallbackConfig } from '@tmagic/stage'; import type { CustomizeMoveableOptionsCallbackConfig } from '@tmagic/stage';
import { asyncLoadJs, calcValueByFontsize } from '@tmagic/utils'; import { asyncLoadJs, calcValueByFontsize } from '@tmagic/utils';
@ -78,7 +78,7 @@ const editor = ref<InstanceType<typeof TMagicEditor>>();
const deviceGroup = ref<InstanceType<typeof DeviceGroup>>(); const deviceGroup = ref<InstanceType<typeof DeviceGroup>>();
const iframe = ref<HTMLIFrameElement>(); const iframe = ref<HTMLIFrameElement>();
const previewVisible = ref(false); const previewVisible = ref(false);
const value = ref(dsl); const value = ref<MApp>(dsl);
const defaultSelected = ref(dsl.items[0].id); const defaultSelected = ref(dsl.items[0].id);
const propsValues = ref<Record<string, any>>({}); const propsValues = ref<Record<string, any>>({});
const propsConfigs = ref<Record<string, any>>({}); const propsConfigs = ref<Record<string, any>>({});
@ -101,6 +101,7 @@ const previewUrl = computed(
); );
const collectorOptions = { const collectorOptions = {
id: '',
name: '蒙层', name: '蒙层',
isTarget: (key: string | number, value: any) => isTarget: (key: string | number, value: any) =>
typeof key === 'string' && typeof value === 'string' && key.includes('events') && value.startsWith('overlay_'), typeof key === 'string' && typeof value === 'string' && key.includes('events') && value.startsWith('overlay_'),