Applying classes on specific viewport breakpoints behaves weirdly on page refresh

让人想犯罪 __ 提交于 2019-12-24 13:50:12

问题


  • Stack: Nuxt.js + Vuetify.js
  • Issue: Setting classes depending on breakpoint behaves abnormally
  • Attempt: In ~/components/SubComponent.vue I want to display text with large font on small screens and over, and colorize my text in red only on small screens:

    <v-flex
      xs12
      sm4
      :class="{
        'display-3': $vuetify.breakpoint.smAndUp,
        'red--text': $vuetify.breakpoint.xs
      }">
      Sub component
    </v-flex>
    
  • Output: Whenever I refresh, I see the text is red and small on small screens (my laptop).

  • Note: I get weird behaviors with this approach whenever I try to combine more classes carefully, but here I am just providing a minimalist example.

  • Question: Why this happens and how to overcome it?

  • In case you are curious this is a link to reproduce the issue: here

来源:https://stackoverflow.com/questions/55179456/applying-classes-on-specific-viewport-breakpoints-behaves-weirdly-on-page-refres

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!