fix: canvas api error (#338)

This commit is contained in:
Hexqi 2024-03-15 17:51:04 +08:00 committed by GitHub
parent 38c89a856c
commit 68637db8db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View File

@ -119,7 +119,7 @@ export default {
iframeMonitoring()
initCanvas({ emit, renderer: detail, iframe: iframe.value, controller: props.controller })
useCanvas().renderer.value = window.api
useCanvas().renderer.value = { ...detail, ...window.canvasApi }
const doc = iframe.value.contentDocument
const win = iframe.value.contentWindow

View File

@ -424,15 +424,19 @@ export const api = {
getGlobalState,
getDataSourceMap,
setDataSourceMap,
setGlobalState,
getCurrent,
setGlobalState
}
const canvasApi = {
getCurrent,
setLocales,
getNodeById: getNode,
updateRect,
addStyle,
addScript,
addStyle,
addScript,
canvasDispatch
}
window.api = api
window.Builtin = Builtin
window.canvasApi = canvasApi
window.Builtin = Builtin