简体   繁体   中英

Different behavior between render function & template in Vue 3 Nested Router

Using Vue 3 Nested Router, I setup a Structure like this:

root1
  └ Parent Route (router-view with Render Function)
      └ Child Route [FAIL TO RENDER]
root2
  └ Parent Route (router-view with Template)
      └ Child Route [FINE]

In my mind, these two ways are interchangeable, but the actual performance is different. What's the problem?

Furthermore, is

render() { return Vue.h("router-view") }

&

template: "<router-view></router-view>"

are really Completely the Same in Vue 3?

Here is the Example .

It should be :

  component: {
    render() {
      return Vue.h(VueRouter.RouterView) 
    }
  },

instead of :

render() { return Vue.h("router-view") }

custom components should be used with plain name in PascalCase format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM