quasar icon indicating copy to clipboard operation
quasar copied to clipboard

[Vue warn]: Failed to mount component: template or render function not defined

Open Mohanrau opened this issue 8 years ago • 2 comments

Software version

Quasar:v0.15.1 OS:win10 Node:latest NPM:latest Browsers:all iOS: Android: Any other software related to your bug:

JsFiddle (for Quasar v0.15+ only)

What did you get as the error?

Everything seems fine but getting above error Migrate from v0.14.9 using vuex & vuex-router-sync

5

What were you expecting?

What steps did you take, to get the error?

Mohanrau avatar Feb 22 '18 08:02 Mohanrau

What above error? "Failed to mount component: template or render function not defined" ? I think you can do better than this. Fill in details... How anyone is supposed to investigate your problem without absolutely no clue from you?

Are you lazy loading routes like this in routes.js? component: import('.....') instead of component: () => import('...')

Reopen with more details. Thanks.

rstoenescu avatar Feb 22 '18 08:02 rstoenescu

sorry for that man.I was depressed do know what to do almost spending 1 full day.Here i attach with more details.

router/routes.js


export default [
  {
    path: MODULE_PATH,
    component: () => import('src/application/login/components/Auth'),
    redirect: MODULE_PATH + 'connector',
    name: 'Auth',
    meta: {
      title: 'Login.sideMenu.auth.title',
      menuItem: true,
      requiresNotAuth: true
    },
    children: [
      {
        path: MODULE_PATH + '/reset-password/:key',
        component: () => import('src/application/login/components/ResetPassword'),
        name: 'Reset Password',
        meta: {
          menuItem: false,
          requiresNotAuth: true
        }
      },
      {
        path: MODULE_PATH + 'connector',
        component: () => import('src/application/login/components/Connector'),
        name: 'connector',
        props: true,
        meta: {
          menuItem: false,
          requiresNotAuth: true
        }
      },
      {
        path: MODULE_PATH + 'login/admin',
        component: () => import('src/application/login/components/Admin'),
        name: 'Admin',
        props: true,
        meta: {
          menuItem: false,
          requiresNotAuth: true
        }
      },
      {
        path: MODULE_PATH + 'update/link/:email/:token',
        component: () => import('src/application/login/components/Admin'),
        name: 'Update From Mail Link',
        props: true,
        meta: {
          menuItem: false,
          requiresNotAuth: true
        }
      },
      {
        path: MODULE_PATH + 'reset',
        component: () => import('src/application/login/components/Admin'),
        name: 'Reset',
        props: true,
        meta: {
          menuItem: false,
          requiresNotAuth: true
        }
      },
      // Remove in production
      {
        path: MODULE_PATH + 'register',
        component: () => import('src/application/login/components/Register'),
        name: 'Register',
        meta: {
          title: 'Register',
          icon: 'assignment_ind',
          menuItem: true,
          requiresNotAuth: true
        }
      }
    ]
  }
]

**router/index.js**

```import Vue from 'vue'
import VueRouter from 'vue-router'

import { routes } from 'src/application/'
import { requireAuth } from '../services/authService'
import navStore from '../services/navigationService'

Vue.use(VueRouter)

// Init router defaults
const Router = new VueRouter({
  mode: process.env.VUE_ROUTER_MODE,
  base: process.env.VUE_ROUTER_BASE,
  linkActiveClass: 'open active',
  scrollBehavior: () => ({ y: 0 }),
  routes
})

// Capture route transition
Router.beforeEach((to, from, next) => {
  // Scroll top
  // document.documentElement.scrollTop = 0
  // document.body.scrollTop = 0
  // Check meta.requiresAuth if yes allow user to next level
  if (to.matched.some(record => record.meta.requiresAuth)) {
    if (!requireAuth()) {
      return next({path: '/auth'})
    } else {
      return next()
    }
  }
  // Access public pages
  if (to.matched.some(record => record.meta.requiresNotAuth)) {
    if (requireAuth()) {
      return next({path: '/'})
    }
  }
  // Pass selected route details through meta title,icon & etc..
  if (to.meta) {
    navStore.set(to.meta)
  }
  next()
})
export default Router

Mohanrau avatar Feb 22 '18 09:02 Mohanrau