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 b02335f67..370d6ca63 100644 --- a/packages/canvas/render/src/RenderMain.js +++ b/packages/canvas/render/src/RenderMain.js @@ -17,7 +17,7 @@ import * as TinyVueIcon from '@opentiny/vue-icon' 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 @@ -424,5 +424,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 9cfd91c02..dab5021e3 100644 --- a/packages/canvas/render/src/runner.js +++ b/packages/canvas/render/src/runner.js @@ -10,7 +10,7 @@ * */ -import { createApp } from 'vue' +import { createApp, h } from 'vue' import { addScript, addStyle, dynamicImportComponents, updateDependencies } from '../../common' import TinyI18nHost, { I18nInjectionKey } from '@opentiny/tiny-engine-common/js/i18n' import Main, { api } from './RenderMain' @@ -49,7 +49,7 @@ const renderer = { const create = async (config) => { const { beforeAppCreate, appCreated } = config.lifeCycles || {} if (typeof beforeAppCreate === 'function') { - await beforeAppCreate() + await beforeAppCreate({ Vue: { h }, canvasWin: window, api }) } App && App.unmount() App = null @@ -63,12 +63,14 @@ const create = async (config) => { dispatch('canvasReady', { detail: renderer }) App = 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)