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

    Navigation To Bookmark On Next Page

    Framework
    3
    3
    201
    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.
    • O
      omgwalt last edited by

      I have a page that contains too much text on it, so I need to split it up into two pages.

      The page is at ./index.html#/pageone

      and the second page is at ./index.html#/pagetwo

      I want a link on pageone to reference a bookmark on pagetwo, something like this:

      ./index.html#/pagetwo/#bookmark.

      The above example doesn’t work. It just takes me to the top of pagetwo. How can I fix it to reference that bookmark on pagetwo when clicking from pageone?

      S 1 Reply Last reply Reply Quote 0
      • S
        suleiman_as @omgwalt last edited by suleiman_as

        @omgwalt
        You can do it like this:

        <q-btn :to="{ path: '/pagetwo', hash: 'bookmark' }" />
        
        <q-btn :to="{ name: 'pagetwo', hash: 'bookmark' }" />
        

        for the scroll behavior, you may do what ever you want:

        export default function(/* { store, ssrContext } */) {
          const Router = new VueRouter({
            //alway to top
            // scrollBehavior: () => ({ x: 0, y: 0 }),
        
            //to hash || to top
            scrollBehavior: function(to, from, savedPosition) {
              if (to.hash) {
                return { selector: to.hash };
              } else {
                return { x: 0, y: 0 };
              }
            },
            routes,
        
            // Leave these as they are and change in quasar.conf.js instead!
            // quasar.conf.js -> build -> vueRouterMode
            // quasar.conf.js -> build -> publicPath
            mode: process.env.VUE_ROUTER_MODE,
            base: process.env.VUE_ROUTER_BASE
          });
        
          return Router;
        }
        
        1 Reply Last reply Reply Quote 0
        • O
          omgwalt last edited by

          Thank you!

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