Error using v-go-back



  • Hello !! I am trying to use the new Directive “v-go-back”, but i am getting the following error:
    [Vue warn]: Invalid expression. Generated function body: /

    I am using that on my menu like that:
    <quasar-drawer-link v-go-back="/" icon=“exit_to_app”>
    Logout
    </quasar-drawer-link>

    My routes:
    let routes = {
    // Not found
    ’*’: {
    component: load(‘error404’)
    },

    // Index
    ’/’: {
    name: ‘index’,
    component: load(‘index’)
    },

    ‘/login’: {
    name: ‘login’,
    component: load(‘auth/login’)
    },

    ‘/register’: {
    name: ‘register’,
    component: load(‘auth/register’)
    },
    }

    Any idea ?
    Thanks!!


  • Admin

    Surround / with simple quotes. You should use it like this: v-go-back="’/’"
    Please note double quote, quote, /, quote, double quote. Thjs is due to Vue inner workings.



  • thanks @rstoenescu !! It works now ! Maybe we must update the documentation too about that .?


  • Admin

    Yeah, just use it like you would with v-link.



  • Hi @rstoenescu
    I have some issued with v-link/v-go-back directive. Please guide me some thing about them :)
    How can I use v-go-back to back 1 step in the window histories ? We can do some action to call async to logout with v-go-back or not ? The v-link can apply active class for button or not ?


  • Admin

    @hata
    v-link applies router-link-active CSS class when it’s appropriate.
    v-go-back can only be used with a route. Cant specify number of steps and can’t call an async function when being triggered. Because this is a convenience directive. If you want a specific behavior you can just add @click event to your element and trigger your async function along window.history.go(-1).


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.