Seven, Vue Router Named Views

Named Views

When a page wants to show multiple views, rather than nested show, you need to use a named view. Have multiple individual named in the interface view, rather than just a single outlet. If you router-viewdo not set the name, the default name for thedefault

<!-- 设置多个视图出口 -->
<router-view></router-view>
<router-view name="leftMenu"></router-view>
<router-view name="rightContent"></router-view>

Since a view corresponding to a render component outlet, and therefore, for the same route, a plurality of assemblies requires multiple views. The routing configuration componentscomponent must be configured withs

<script>
    const router = new VueRouter({
        routes: [
            path: '/',
            components: {
                'default': Header,
                'leftMenu': Menu,
                'rightContent': Content
            }
        ]
    })
</script>

Guess you like

Origin www.cnblogs.com/yuxi2018/p/11967271.html