vue-bulma / vue-admin

We are refactoring it, using the latest Vue and Bulma. WIP
9.43k stars 1.61k forks source link

router #222

Open tonyjiafan opened 7 years ago

tonyjiafan commented 7 years ago

Hello there! I can only continue to develop in your sub-route? My own configuration of the routing can not be displayed correctly! For example, my own defined loging module corresponds to the '/ login' route #

acampagnaro commented 7 years ago

I use it this way

router.beforeEach((to, from, next) => { if (to.meta.auth === undefined) { return next() } if ((to.meta.auth !== undefined) || (to.meta.auth !== false) || (to.meta.auth !== undefined)) { if (!store.state.user.id && to.path !== '/login') { return router.push('/login') } return next() } return next() })

On Tue, Aug 29, 2017 at 8:54 AM Bengxiaka notifications@github.com wrote:

Hello there! I can only continue to develop in your sub-route? My own configuration of the routing can not be displayed correctly! For example, my own defined loging module corresponds to the '/ login' route #

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vue-bulma/vue-admin/issues/222, or mute the thread https://github.com/notifications/unsubscribe-auth/AJsBShNv83BSA_enZiGoRQ14nPgJhMBrks5sc_v4gaJpZM4PFzXx .

tonyjiafan commented 7 years ago

thanks

acampagnaro commented 7 years ago

Was that what you needed?

On Tue, Aug 29, 2017 at 10:24 PM Bengxiaka notifications@github.com wrote:

thanks

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/vue-bulma/vue-admin/issues/222#issuecomment-325850618, or mute the thread https://github.com/notifications/unsubscribe-auth/AJsBSo9r9zRMsUWlx0Lzm_Q5OkzIz9Rwks5sdLnXgaJpZM4PFzXx .

acampagnaro commented 7 years ago

this??

import Vue from 'vue' import Router from 'vue-router' import menuModule from 'vuex-store/modules/menu' import store from '../store' Vue.use(Router)

const router = new Router({ mode: 'history', // Demo is living in GitHub.io, so required! hash # history: true, linkActiveClass: 'is-active', scrollBehavior: () => ({ y: 0 }), routes: [ { name: 'Home', path: '/', meta: {auth: true}, //auth component: require('../views/Home') }, { name: 'Users', path: '/manager/users', meta: {auth: true}, // auth component: require('../views/auth/Users') }, { name: 'Login', path: '/manager/auth', meta: {auth: false}, // no require auth component: require('../views/auth/Login') }] })

On Tue, Aug 29, 2017 at 11:07 PM Bengxiaka notifications@github.com wrote:

Is not it! But still thank you just now! I did not know how to control your routing, I would like to leave your routing control, their relatively simple routing, can easily read the routing! Do you have any suggestions? I need your guidance .... thanks

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/vue-bulma/vue-admin/issues/222#issuecomment-325856972, or mute the thread https://github.com/notifications/unsubscribe-auth/AJsBStLNntA18wv7R42OIFTfdLQLo3mEks5sdMPQgaJpZM4PFzXx .

tonyjiafan commented 7 years ago

thanks 🏋🏋