refactor: adjust createApp related API signatures

BREAKING CHANGE: `createApp` API has been adjusted.

  - `createApp()` now accepts the root component, and optionally a props
  object to pass to the root component.
  - `app.mount()` now accepts a single argument (the root container)
  - `app.unmount()` no longer requires arguments.

  New behavior looks like the following:

  ``` js
  const app = createApp(RootComponent)
  app.mount('#app')
  app.unmount()
  ```
This commit is contained in:
Evan You
2020-01-23 15:05:38 -05:00
parent eacd390992
commit c07751fd36
25 changed files with 276 additions and 326 deletions

View File

@@ -93,11 +93,11 @@ const DemoGrid = {
</div>
<!-- App script -->
<script>
const App = {
Vue.createApp({
components: {
DemoGrid
},
data: {
data: () => ({
searchQuery: '',
gridColumns: ['name', 'power'],
gridData: [
@@ -106,10 +106,8 @@ const App = {
{ name: 'Jackie Chan', power: 7000 },
{ name: 'Jet Li', power: 8000 }
]
}
}
Vue.createApp().mount(App, '#demo')
})
}).mount('#demo')
</script>
<style>