Skip to content

Cannot set property 'innerHTML' of undefined #637

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

Closed
CaiPeng1989 opened this issue Jan 19, 2020 · 7 comments
Closed

Cannot set property 'innerHTML' of undefined #637

CaiPeng1989 opened this issue Jan 19, 2020 · 7 comments

Comments

@CaiPeng1989
Copy link

CaiPeng1989 commented Jan 19, 2020

Version

3.0.0-alpha.2

Reproduction link

https://codepen.io/caipeng1989/pen/YzPJbbm

Steps to reproduce

const {
  createApp,
  defineComponent
} = Vue

const App = defineComponent({
  template: `<div>app</div>`
})

createApp(App).mount('#app')

What is expected?

Render correctly

What is actually happening?

TypeError: Cannot read property 'innerHTML' of undefined

@underfin
Copy link
Member

You should run createApp().mount(App, '#app')

@CaiPeng1989
Copy link
Author

createApp().mount(App, '#app')

The default code is like this.
But, Global API Change said:

import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)

app.config.ignoredElements = [/^app-/]

app.use(/* ... */)
app.mixin(/* ... */)
app.component(/* ... */)
app.directive(/* ... */)

app.mount('#app')

@underfin
Copy link
Member

Year.The implementation has diffrent with sfc.

@CaiPeng1989
Copy link
Author

So we need to write code like this:

import { createApp } from 'vue'
import App from './App.vue'

const app = createApp()

app.config.ignoredElements = [/^app-/]

app.use(/* ... */)
app.mixin(/* ... */)
app.component(/* ... */)
app.directive(/* ... */)

app.mount(App, '#app')

@underfin
Copy link
Member

Yea.It is works for current master code.

@posva
Copy link
Member

posva commented Jan 19, 2020

@posva posva closed this as completed Jan 19, 2020
@yyx990803
Copy link
Member

The RFC PR had outdated summary (fixed)

@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants