No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Error using v-go-back

    Help
    3
    7
    3514
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sponz last edited by

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

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        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.

        1 Reply Last reply Reply Quote 1
        • S
          Sponz last edited by

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

          1 Reply Last reply Reply Quote 0
          • rstoenescu
            rstoenescu Admin last edited by

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

            1 Reply Last reply Reply Quote 0
            • H
              hata last edited by

              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 ?

              1 Reply Last reply Reply Quote 0
              • rstoenescu
                rstoenescu Admin last edited by rstoenescu

                @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).

                1 Reply Last reply Reply Quote 0
                • H
                  hata last edited by

                  @rstoenescu
                  v-go-back directive is the same as $router.back() or different? I don’t know what is different between them?

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post