Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passed all test; browser manual test is also ok #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import App from './App.vue'
import { createApp } from './mini-renderer.js'
// import { createApp } from '@vue/runtime-dom'

console.log('begin create App')
createApp(App).mount('#app')

// import { createApp } from 'vue'
Expand Down
28 changes: 27 additions & 1 deletion src/mini-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,33 @@ const render = createRenderer({
})

const createApp = (...args) => {
//TODO
// const App ={
// mount(element){
// const page = args[0]
// const root = document.getElementById(element)
// const appRender = render.render(null, new RendererElement(root))
// appRender.render(page)
// }
// }

const app = render.createApp(...args)
console.log('app=', app)
const { mount } = app

app.mount = (element) => {
let container
if (typeof element === 'string')
container = document.querySelector(element)
else
container = element

container.innerHTML = ''
const proxy = mount(container, false, false)

return proxy
}

return app;
}

export {
Expand Down