Skip to content

Commit

Permalink
refactor: render
Browse files Browse the repository at this point in the history
  • Loading branch information
hexqi committed Sep 9, 2024
1 parent 86b4369 commit f396562
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/canvas/render/src/RenderMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ 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, setNode } 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 @@ -347,7 +356,7 @@ const getNode = (id, parent) => (id ? getNodeById(id, parent) : schema)

let canvasRenderer = null

const defaultRenderer = function() {
const defaultRenderer = function () {
// 渲染画布增加根节点,与出码和预览保持一致
const rootChildrenSchema = {
componentName: 'div',
Expand All @@ -373,14 +382,6 @@ const setRenderer = (fn) => {
canvasRenderer = fn
}

let rendererMounted

const getRendererMounted = () => rendererMounted || function() {}

const setRendererMounted = (fn) => {
rendererMounted = fn
}

export default {
setup() {
provide('rootSchema', schema)
Expand Down Expand Up @@ -445,7 +446,5 @@ export const api = {
setGlobalState,
setNode,
getRenderer,
setRenderer,
getRendererMounted,
setRendererMounted
setRenderer
}

0 comments on commit f396562

Please sign in to comment.