Skip to content

Commit

Permalink
fix(useDisplay): more intuitive use of mobile-breakpoint (#20311)
Browse files Browse the repository at this point in the history
fixes #19883

Co-authored-by: jsek <im68889094144@outlook.com>
Co-authored-by: John Leider <9064066+johnleider@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 27, 2025
1 parent 8e61f2d commit cff590e
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/vuetify/src/composables/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,17 @@ export function useDisplay (
if (!display) throw new Error('Could not find Vuetify display injection')

const mobile = computed(() => {
if (props.mobile != null) return props.mobile
if (!props.mobileBreakpoint) return display.mobile.value

const breakpointValue = typeof props.mobileBreakpoint === 'number'
? props.mobileBreakpoint
: display.thresholds.value[props.mobileBreakpoint]

return display.width.value < breakpointValue
if (props.mobile) {
return true
} else if (typeof props.mobileBreakpoint === 'number') {
return display.width.value < props.mobileBreakpoint
} else if (props.mobileBreakpoint) {
return display.width.value < display.thresholds.value[props.mobileBreakpoint]
} else if (props.mobile === null) {
return display.mobile.value
} else {
return false
}
})

const displayClasses = computed(() => {
Expand Down

0 comments on commit cff590e

Please sign in to comment.