I was just upgraded to Vue2.0, and not so familiar with it.
One change makes trouble for me, that the vue-router initialization [docs] is changed:
In my case, the initialization code is changed as below:
Old
import RootApp from './components/RootApp.vue';
router.start(RootApp, '#app')
New
import RootApp from './components/RootApp.vue';
new Vue({
el: '#app',
router: router,
render: h => h(RootApp)
})
Soon I found that specifying the RootApp in such a manner of new case make the root app code ambiguous for me.
That in old case, the $root element of each sub-route element yields the RootApp instance, while in new case, it yields another component which contains the RootApp instance as its only child.
So, it makes trouble, is there any way to create the RootApp just acts the root node in Vue2?
Or I guess, is there any way to create an Vue instance like the below (but failed when tried):
# Failed code to tell what I want
import RootApp from './component/RootApp.vue';
new RootApp({
el: '#app',
router: router,
});