Skip to content

Commit ba911cf

Browse files
author
yaoyun8
authored
feat: UniBuy画布渲染 (#2)
* feat: unibuy-render * fix:eslint报错
1 parent 7d12156 commit ba911cf

File tree

3 files changed

+9
-89
lines changed

3 files changed

+9
-89
lines changed

mockServer/src/mock/get/app-center/v1/apps/schema/918.json

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,90 +2048,7 @@
20482048
}
20492049
],
20502050
"bridge": [],
2051-
"utils": [
2052-
{
2053-
"name": "axios",
2054-
"type": "npm",
2055-
"content": {
2056-
"type": "JSFunction",
2057-
"value": "",
2058-
"package": "axios",
2059-
"destructuring": false,
2060-
"exportName": "axios"
2061-
}
2062-
},
2063-
{
2064-
"name": "Button",
2065-
"type": "npm",
2066-
"content": {
2067-
"package": "@opentiny/vue",
2068-
"version": "",
2069-
"exportName": "Button",
2070-
"subName": "",
2071-
"destructuring": true,
2072-
"main": ""
2073-
}
2074-
},
2075-
{
2076-
"name": "Menu",
2077-
"type": "npm",
2078-
"content": {
2079-
"type": "JSFunction",
2080-
"value": "",
2081-
"package": "@opentiny/vue",
2082-
"exportName": "NavMenu",
2083-
"destructuring": true
2084-
}
2085-
},
2086-
{
2087-
"name": "Modal ",
2088-
"type": "npm",
2089-
"content": {
2090-
"package": "@opentiny/vue",
2091-
"version": "",
2092-
"exportName": "Modal ",
2093-
"subName": "",
2094-
"destructuring": true,
2095-
"main": ""
2096-
}
2097-
},
2098-
{
2099-
"name": "npm",
2100-
"type": "function",
2101-
"content": {
2102-
"type": "JSFunction",
2103-
"value": "''"
2104-
}
2105-
},
2106-
{
2107-
"name": "Pager",
2108-
"type": "npm",
2109-
"content": {
2110-
"package": "@opentiny/vue",
2111-
"version": "",
2112-
"exportName": "Pager",
2113-
"subName": "",
2114-
"destructuring": true,
2115-
"main": ""
2116-
}
2117-
},
2118-
{
2119-
"name": "test",
2120-
"type": "function",
2121-
"content": {
2122-
"type": "JSFunction",
2123-
"value": "function test() {\r\n return 'test'\r\n}"
2124-
}
2125-
},
2126-
{
2127-
"name": "util",
2128-
"type": "function",
2129-
"content": {
2130-
"type": "JSFunction",
2131-
"value": "function util () {\r\n console.log(321)\r\n}"
2132-
}
2133-
}
2134-
],
2051+
"utils": [],
21352052
"config": {
21362053
"sdkVersion": "1.0.3",
21372054
"historyMode": "hash",

packages/canvas/render/src/RenderMain.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { I18nInjectionKey } from 'vue-i18n'
1515
import { useBroadcastChannel } from '@vueuse/core'
1616
import { constants, utils as commonUtils } from '@opentiny/tiny-engine-utils'
1717
import renderer, { parseData, setConfigure, setController, globalNotify, isStateAccessor } from './render'
18-
import { getNode as getNodeById, clearNodes, getRoot, setContext, getContext, setCondition, context } from './context'
18+
import { getNode as getNodeById, clearNodes, getRoot, setContext, getContext, setCondition, context, setNode } from './context'
1919
import CanvasEmpty from './CanvasEmpty.vue'
2020

2121
const { BROADCAST_CHANNEL } = constants
@@ -422,5 +422,6 @@ export const api = {
422422
getGlobalState,
423423
getDataSourceMap,
424424
setDataSourceMap,
425-
setGlobalState
425+
setGlobalState,
426+
setNode,
426427
}

packages/canvas/render/src/runner.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const renderer = {
112112
const create = async (config) => {
113113
const { beforeAppCreate, appCreated } = config.lifeCycles || {}
114114
if (typeof beforeAppCreate === 'function') {
115-
await beforeAppCreate()
115+
await beforeAppCreate({ Vue, canvasWin: window, api })
116116
}
117117
App && App.unmount()
118118
App = null
@@ -126,12 +126,14 @@ const create = async (config) => {
126126
dispatch('canvasReady', { detail: renderer })
127127

128128
App = Vue.createApp(Main).use(TinyI18nHost).provide(I18nInjectionKey, TinyI18nHost)
129-
App.config.globalProperties.lowcodeConfig = window.parent.TinyGlobalConfig
130-
App.mount(document.querySelector('#app'))
129+
131130
if (typeof appCreated === 'function') {
132131
await appCreated(App)
133132
}
134133

134+
App.config.globalProperties.lowcodeConfig = window.parent.TinyGlobalConfig
135+
App.mount(document.querySelector('#app'))
136+
135137
new ResizeObserver(() => {
136138
dispatch('canvasResize')
137139
}).observe(document.body)

0 commit comments

Comments
 (0)