Browse Source

WorldModel open

master
修宁 7 months ago
parent
commit
05a3c3d672
  1. 45
      src/views/ModelMain.vue
  2. 9
      src/views/ModelMainInit.ts

45
src/views/ModelMain.vue

@ -118,34 +118,35 @@ export default {
ModelMainInit() ModelMainInit()
}, },
mounted() { mounted() {
ModelMainMounted() ModelMainMounted().then(() => {
// widget // widget
const allWidget = getAllWidget() const allWidget = getAllWidget()
allWidget.forEach((widget) => { allWidget.forEach((widget) => {
if (widget?.shortcut && widget?.name && widget?.side) { if (widget?.shortcut && widget?.name && widget?.side) {
const shortKey = normalizeShortKey(widget.shortcut) const shortKey = normalizeShortKey(widget.shortcut)
widget.shortcut = shortKey widget.shortcut = shortKey
if (shortKey) { if (shortKey) {
system.hotkeys(shortKey, (event) => { system.hotkeys(shortKey, (event) => {
if (widget.side === 'left') { if (widget.side === 'left') {
this.sectionLeftName = widget.name this.sectionLeftName = widget.name
this.hideLeft = false this.hideLeft = false
} else if (widget.side === 'right') { } else if (widget.side === 'right') {
this.sectionRightName = widget.name this.sectionRightName = widget.name
this.hideRight = false this.hideRight = false
} else if (widget.side === 'bottom') { } else if (widget.side === 'bottom') {
this.sectionBottomName = widget.name this.sectionBottomName = widget.name
this.hideBottom = false this.hideBottom = false
} }
event.preventDefault() event.preventDefault()
}) })
}
} }
} })
}) })
}, },
unmounted() { unmounted() {

9
src/views/ModelMainInit.ts

@ -37,13 +37,10 @@ export function ModelMainInit() {
const worldModel = new WorldModel() const worldModel = new WorldModel()
window['worldModel'] = worldModel window['worldModel'] = worldModel
worldModel.init().then(() => {
worldModel.open()
})
} }
export function ModelMainMounted() { export function ModelMainMounted() {
forEachMenu((menu) => { forEachMenu((menu) => {
if (typeof menu.click === 'function') { if (typeof menu.click === 'function') {
@ -58,6 +55,10 @@ export function ModelMainMounted() {
} }
} }
}) })
return worldModel.init().then(() => {
worldModel.open()
})
} }
export function ModelMainUnmounted() { export function ModelMainUnmounted() {

Loading…
Cancel
Save