Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UniBuy画布渲染 #2

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 1 addition & 84 deletions mockServer/src/mock/get/app-center/v1/apps/schema/918.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions packages/canvas/render/src/RenderMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -422,5 +422,6 @@ export const api = {
getGlobalState,
getDataSourceMap,
setDataSourceMap,
setGlobalState
setGlobalState,
setNode,
}
8 changes: 5 additions & 3 deletions packages/canvas/render/src/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down