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:
@@ -69,43 +69,43 @@ const TreeItem = {
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
const App = {
|
||||
components: {
|
||||
TreeItem
|
||||
},
|
||||
data: {
|
||||
treeData: {
|
||||
name: 'My Tree',
|
||||
const treeData = {
|
||||
name: 'My Tree',
|
||||
children: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
children: [
|
||||
{
|
||||
name: 'child folder',
|
||||
children: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
},
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
children: [
|
||||
{
|
||||
name: 'child folder',
|
||||
children: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
},
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
children: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
}
|
||||
{ name: 'wat' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vue.createApp().mount(App, '#demo')
|
||||
Vue.createApp({
|
||||
components: {
|
||||
TreeItem
|
||||
},
|
||||
data: () => ({
|
||||
treeData
|
||||
})
|
||||
}).mount('#demo')
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user