How to specify different margin for different screen sizes using breakpoint in Vuetify

前端 未结 3 2029
小鲜肉
小鲜肉 2021-02-01 17:24

Question:

I have a loop displaying specified amount of cards.

The problem is with ma-5 attribute in . On xs

相关标签:
3条回答
  • 2021-02-01 17:40

    There is an easier way now:

    <v-card 
      v-for="card in filteredCards"
      :key="card.id"
      class="ma-0 ma-md-5"
    >
    {{card.title}}
    </v-card>
    

    this applies margin of 0 for XS and SM, and margin 5 for MD and up

    0 讨论(0)
  • 2021-02-01 17:47

    The helper classes apply margin or padding at a given breakpoint. These classes can be applied using the following format: {property}{direction}-{breakpoint}-{size}.

    0 讨论(0)
  • 2021-02-01 17:59

    $vuetify.breakpoint.smAndDown

    Notice $vuetify

    In your case:

    <v-flex 
        v-for="card in filteredCards"
        :key="card.id"
        :class="{'ma-0': $vuetify.breakpoint.smAndDown, 'ma-5': $vuetify.breakpoint.mdAndUp}"
        xs12 sm6 md4  
    >
    

    Check docs (Breakpoint object)

    0 讨论(0)
提交回复
热议问题