diff --git a/mockServer/src/mock/get/app-center/v1/apps/schema/918.json b/mockServer/src/mock/get/app-center/v1/apps/schema/918.json index e5351b18e..d3fda570f 100644 --- a/mockServer/src/mock/get/app-center/v1/apps/schema/918.json +++ b/mockServer/src/mock/get/app-center/v1/apps/schema/918.json @@ -2048,90 +2048,7 @@ } ], "bridge": [], - "utils": [ - { - "name": "axios", - "type": "npm", - "content": { - "type": "JSFunction", - "value": "", - "package": "axios", - "destructuring": false, - "exportName": "axios" - } - }, - { - "name": "Button", - "type": "npm", - "content": { - "package": "@opentiny/vue", - "version": "", - "exportName": "Button", - "subName": "", - "destructuring": true, - "main": "" - } - }, - { - "name": "Menu", - "type": "npm", - "content": { - "type": "JSFunction", - "value": "", - "package": "@opentiny/vue", - "exportName": "NavMenu", - "destructuring": true - } - }, - { - "name": "Modal ", - "type": "npm", - "content": { - "package": "@opentiny/vue", - "version": "", - "exportName": "Modal ", - "subName": "", - "destructuring": true, - "main": "" - } - }, - { - "name": "npm", - "type": "function", - "content": { - "type": "JSFunction", - "value": "''" - } - }, - { - "name": "Pager", - "type": "npm", - "content": { - "package": "@opentiny/vue", - "version": "", - "exportName": "Pager", - "subName": "", - "destructuring": true, - "main": "" - } - }, - { - "name": "test", - "type": "function", - "content": { - "type": "JSFunction", - "value": "function test() {\r\n return 'test'\r\n}" - } - }, - { - "name": "util", - "type": "function", - "content": { - "type": "JSFunction", - "value": "function util () {\r\n console.log(321)\r\n}" - } - } - ], + "utils": [], "config": { "sdkVersion": "1.0.3", "historyMode": "hash", diff --git a/packages/canvas/render/src/RenderMain.js b/packages/canvas/render/src/RenderMain.js index dcee72a78..0e1899c08 100644 --- a/packages/canvas/render/src/RenderMain.js +++ b/packages/canvas/render/src/RenderMain.js @@ -15,7 +15,7 @@ import { I18nInjectionKey } from 'vue-i18n' import { useBroadcastChannel } from '@vueuse/core' import { constants, utils as commonUtils } from '@opentiny/tiny-engine-utils' import renderer, { parseData, setConfigure, setController, globalNotify, isStateAccessor } from './render' -import { getNode as getNodeById, clearNodes, getRoot, setContext, getContext, setCondition, context } from './context' +import { getNode as getNodeById, clearNodes, getRoot, setContext, getContext, setCondition, context, setNode } from './context' import CanvasEmpty from './CanvasEmpty.vue' const { BROADCAST_CHANNEL } = constants @@ -422,5 +422,6 @@ export const api = { getGlobalState, getDataSourceMap, setDataSourceMap, - setGlobalState + setGlobalState, + setNode, } diff --git a/packages/canvas/render/src/runner.js b/packages/canvas/render/src/runner.js index 84df0b50d..c23769a39 100644 --- a/packages/canvas/render/src/runner.js +++ b/packages/canvas/render/src/runner.js @@ -112,7 +112,7 @@ const renderer = { const create = async (config) => { const { beforeAppCreate, appCreated } = config.lifeCycles || {} if (typeof beforeAppCreate === 'function') { - await beforeAppCreate() + await beforeAppCreate({ Vue, canvasWin: window, api }) } App && App.unmount() App = null @@ -126,12 +126,14 @@ const create = async (config) => { dispatch('canvasReady', { detail: renderer }) App = Vue.createApp(Main).use(TinyI18nHost).provide(I18nInjectionKey, TinyI18nHost) - App.config.globalProperties.lowcodeConfig = window.parent.TinyGlobalConfig - App.mount(document.querySelector('#app')) + if (typeof appCreated === 'function') { await appCreated(App) } + App.config.globalProperties.lowcodeConfig = window.parent.TinyGlobalConfig + App.mount(document.querySelector('#app')) + new ResizeObserver(() => { dispatch('canvasResize') }).observe(document.body)