首页 文章

如何根据Vuetify中的屏幕大小更改按钮的位置

提问于
浏览
0

我正在寻找一种方法来改变按钮的位置,这取决于使用Vuetify的屏幕大小,按钮应该在右下方 .

this is the position of the button on a large screen

This is the position on a smaller screen

2 回答

  • 0

    就像第一个回答说你必须使用断点 . 这是一个例子 .

    <v-flex xs12 md6 class="text-xs-right">
        <v-btn :block="$vuetify.breakpoint.xsOnly" flat>Cancel</v-btn>
        <v-btn :block="$vuetify.breakpoint.xsOnly" color="primary" @click="onSave()">Save</v-btn>
    </v-flex>
    
  • 0

    您可以使用“断点”,这将允许您根据视口大小应用特定属性 .

    export default {  
      computed: {
        position () {
          switch (this.$vuetify.breakpoint.name) {
            case 'xs': return 'your position'
            case 'sm': return 'your position'
            case 'md': return 'your position'
            case 'lg': return 'your position'
            case 'xl': return 'your position'
          }
        }
      }
    }
    

相关问题