📜  vue 组件:{ 渲染:- Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:13.551000             🧑  作者: Mango

代码示例1
// ====================================================================
//    Routes
// ====================================================================
          {
            path: '/',
            name: 'home',
            component: () => import('./views/Dashboard.vue'),
          },
// ====================================================================
//    Grouped User Routes
// ====================================================================
          {
            path: '/user',
            name: 'user',
            component: { render: h => h('router-view') }, 
              // renders a router-view so no other component is needed.
            children: [
              {
                path: 'list',
                name: 'user.list',
                component: () => import('./views/pages/User/List.vue'),
              },
            ]
          },
        ],
      
/*
Aliasing createElement to h is a common convention you’ll see in 
the Vue ecosystem and is actually required for JSX. Starting with 
version 3.4.0 of the Babel plugin for Vue, we automatically inject 
const h = this.$createElement in any method and getter (not functions 
or arrow functions), declared in ES2015 syntax that has JSX, so you 
can drop the (h) parameter. With prior versions of the plugin, your app 
would throw an error if h was not available in the scope.
https://vuejs.org/v2/guide/render-function.html
*/