Vuetify:Breakpoints
Display Breakpoints
Material Design Breakpoints:
Device | Code | Type | Range |
Extra small | xs | Small to large phone | < 600px |
Small | sm | Small to medium tablet | 600px > < 960px |
Medium | md | Large tablet to laptop | 960px > < 1264px* |
Large | lg | Desktop | 1264px > < 1904px* |
Extra large | xl | 4k and ultra-wide | > 1904px* |
-
-16px
on desktop for browser scrollbar
Breakpoint service
<!-- Vue Component -->
<template>
<v-card :height="height">
...
</v-card>
</template>
<script>
export default {
computed: {
height () {
switch (this.$vuetify.breakpoint.name) {
case 'xs': return 220
case 'sm': return 400
case 'md': return 500
case 'lg': return 600
case 'xl': return 800
}
},
},
}
</script>
CSS/SCSS/SASS 에서 사용방법
- Stackoverflow - How to do breakpoints in scss file with vuetify?
- Stackoverflow - Accessing $display-breakpoints.xs-only in sass file with vue-cli3 project and vuetify
SCSS:
@import '~vuetify/src/styles/settings/_variables';
@media #{map-get($display-breakpoints, 'sm-and-down')} {
.custom-class {
display: block;
}
}
SASS: