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 • 6 comments

Software version

Quasar:v0.15.1 OS:win 10 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?

#1609 Reopen

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

5

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 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

Component folder structure

6

What were you expecting?

What steps did you take, to get the error?

Mohanrau avatar Feb 22 '18 09:02 Mohanrau

Issue solved. vue-router package clash, since quasar itself by default includes all vue related packages.My bad im upgrading from v0.14.9 forgot to remove vue-router from package.json.

Mohanrau avatar Feb 22 '18 17:02 Mohanrau

Issue solved. vue-router package clash, since quasar itself by default includes all vue related packages.My bad im upgrading from v0.14.9 forgot to remove vue-router from package.json.

i've this problem with qcheckbox, i don't understand how to solve. I cannot remove vue router, how can i import then?

stegithub avatar Feb 19 '20 21:02 stegithub

@stegithub You don't need Vue, Vue-router, Vuex, etc, as Quasar includes them automatically for you. If you have these in your package.json, simply remove them and rebuild node_modules.

hawkeye64 avatar Feb 20 '20 15:02 hawkeye64

@stegithub You don't need Vue, Vue-router, Vuex, etc, as Quasar includes them automatically for you. If you have these in your package.json, simply remove them and rebuild node_modules.

i'm using quasar vue plugin, and if i remove vue-router from package and rebuild i cannot import 'vue-router'...is not found package

stegithub avatar Mar 19 '20 21:03 stegithub

i don't understand why q-btn and more others components have not this problem and q-checkbox yes.

stegithub avatar Mar 19 '20 21:03 stegithub

@stegithub Sorry, I didn't get that it was quasar vue-cli plugin. I think your issue is different from the one originally posted here.

hawkeye64 avatar Mar 19 '20 22:03 hawkeye64