Cookies 0.15.8

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

  • Admin

    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

    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.

  • This post is deleted!

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

Log in to reply