Skip to content

Commit

Permalink
feat: UniBuy画布渲染 (#2)
Browse files Browse the repository at this point in the history
* feat: unibuy-render

* fix:eslint报错
  • Loading branch information
yaoyun8 authored and hexqi committed Sep 9, 2024
1 parent 5580086 commit 98cb649
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 90 deletions.
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 @@ -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
Expand Down Expand Up @@ -424,5 +424,6 @@ export const api = {
getGlobalState,
getDataSourceMap,
setDataSourceMap,
setGlobalState
setGlobalState,
setNode,
}
10 changes: 6 additions & 4 deletions packages/canvas/render/src/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 98cb649

Please sign in to comment.