forked from rc/aircox
migrate to vue3; autocomplete still needs work
This commit is contained in:
@ -34,16 +34,16 @@ export default class Builder {
|
||||
* @param {Boolean} [reset=False]: if True, force application recreation.
|
||||
* @return `app.mount`'s result.
|
||||
*/
|
||||
mount({content=null, title=null, el=null, reset=false}={}) {
|
||||
mount({content=null, title=null, el=null, reset=false, props=null}={}) {
|
||||
try {
|
||||
this.unmount()
|
||||
|
||||
let config = this.config
|
||||
if(el === null)
|
||||
el = config.el
|
||||
|
||||
if(reset || !this.app)
|
||||
this.app = this.createApp({title,content,el,...config})
|
||||
this.app = this.createApp({title,content,el,...config}, props)
|
||||
|
||||
this.vm = this.app.mount(el)
|
||||
window.scroll(0, 0)
|
||||
return this.vm
|
||||
@ -53,7 +53,7 @@ export default class Builder {
|
||||
}
|
||||
}
|
||||
|
||||
createApp({el, title=null, content=null, ...config}) {
|
||||
createApp({el, title=null, content=null, ...config}, props) {
|
||||
const container = document.querySelector(el)
|
||||
if(!container)
|
||||
throw `Error: can't get element ${el}`
|
||||
@ -61,7 +61,7 @@ export default class Builder {
|
||||
container.innerHTML = content
|
||||
if(title)
|
||||
document.title = title
|
||||
return createApp(config)
|
||||
return createApp(config, props)
|
||||
}
|
||||
|
||||
unmount() {
|
||||
|
Reference in New Issue
Block a user