Skip to content

[Bug] Screen plugin doesn't updates values after setting new sizes #2221

Closed
@rossity

Description

Software version

Quasar: 0.16
OS: Windows - Chrome/FF

JsFiddle (for Quasar v0.15+ only)

https://jsfiddle.net/d6kousj1/33/

What did you get as the error?

On the initial load of the page after setting a new screen size with the screen plugin, the $q.screen.lt and $q.screen.gt values are not updated unless the screen is resized

I ended up having to manually set the sizes in my custom screen plugin

import { Screen } from 'quasar'

export default ({ Vue }) => {
  Screen.setSizes({
    sm: 600,
    md: 1024,
    xl: 1920
  })

  Screen.gt.xs = Screen.width >= Screen.sizes.sm
  Screen.gt.sm = Screen.width >= Screen.sizes.md
  Screen.gt.md = Screen.width >= Screen.sizes.lg
  Screen.gt.lg = Screen.width >= Screen.sizes.xl
  Screen.lt.sm = Screen.width < Screen.sizes.sm
  Screen.lt.md = Screen.width < Screen.sizes.md
  Screen.lt.lg = Screen.width < Screen.sizes.lg
  Screen.lt.xl = Screen.width < Screen.sizes.xl

  Vue.prototype.$screen = Screen
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions