RENDER VUE COMPONENT IN JS code example

Example: vue component: { render:

// ====================================================================
//    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
*/

Tags:

Html Example