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

    Cookies 0.15.8

    Help
    2
    4
    855
    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
      Sweetyy last edited by Sweetyy

      Hi,
      I am sorry but i really don’t understand how to create a Cookie refering to the doc…
      I correctly added it to the quasar.conf but when i try to write one it does nothing.
      I just want to be able to create a simple cookie in a view.
      Can someone give me an example how to do that ?

      Thanks for the help !

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

        1. Edit quasar.conf to tell Quasar to use the Cookies Quasar plugin:
          framework: {
          plugins: [‘Cookies’]
          }

        2. Reading:
          // outside of a Vue file
          import { Cookies } from ‘quasar’

        var value = Cookies.get(‘cookie_name’)
        When cookie is not set, the return value is undefined.

        // inside of a Vue file
        this.$q.cookies.get(‘cookie_name’)

        1. Writing
          // outside of a Vue file
          import { Cookies } from ‘quasar’

        Cookies.set(‘cookie_name’, cookie_value, options)
        options is an Object which can have the following properties: expire, path, domain, secure. They are explained below.

        // outside of a Vue file
        import { Cookies } from ‘quasar’

        Cookies.set(‘quasar’, ‘framework’, {
        secure: true
        })
        // inside of a Vue file
        this.$q.cookies.set(‘cookie_name’, cookie_value, options)

        Check document.cookie after updates to make sure everything is working. If it’s not working, Cookies are either blocked or you’re in Incognito browser mode.

        1 Reply Last reply Reply Quote 0
        • S
          Sweetyy last edited by Sweetyy

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • S
            Sweetyy last edited by

            Thanks ! My misstake was that i didn’t set option with path: '/'. Now it’s working.

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