add missing "mounted" event
This commit is contained in:
parent
ec4e222c0e
commit
d811f92dda
|
|
@ -3,6 +3,7 @@ import * as React from 'react'
|
|||
import ReactDOM from 'react-dom'
|
||||
import './scripts/app'
|
||||
import routes from './scripts/route'
|
||||
import * as emitter from './scripts/event'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
|
|
@ -19,21 +20,25 @@ function loadModules() {
|
|||
}
|
||||
if (route.react) {
|
||||
const Component = React.lazy(
|
||||
route.react as (() => Promise<{ default: React.ComponentType }>)
|
||||
route.react as () => Promise<{ default: React.ComponentType }>,
|
||||
)
|
||||
const Root = () => (
|
||||
<React.Suspense fallback={route.frame?.() ?? ''}>
|
||||
<Component />
|
||||
</React.Suspense>
|
||||
)
|
||||
if (typeof route.el === 'string') {
|
||||
ReactDOM.render(<Root />, document.querySelector(route.el))
|
||||
} else {
|
||||
ReactDOM.render(<Root />, route.el)
|
||||
}
|
||||
const c =
|
||||
typeof route.el === 'string'
|
||||
? document.querySelector(route.el)
|
||||
: route.el
|
||||
ReactDOM.render(<Root />, c, () => {
|
||||
emitter.emit('mounted', { el: route.el })
|
||||
})
|
||||
}
|
||||
if (route.component) {
|
||||
Vue.prototype.$route = new RegExp(`^${route.path}$`, 'i').exec(blessing.route)
|
||||
Vue.prototype.$route = new RegExp(`^${route.path}$`, 'i').exec(
|
||||
blessing.route,
|
||||
)
|
||||
// eslint-disable-next-line no-new
|
||||
new Vue({
|
||||
el: route.el,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user