(
props: DisplayProps = { mobile: null },
name = getCurrentInstanceName(),
)
| 227 | }, 'display') |
| 228 | |
| 229 | export function useDisplay ( |
| 230 | props: DisplayProps = { mobile: null }, |
| 231 | name = getCurrentInstanceName(), |
| 232 | ) { |
| 233 | const display = inject(DisplaySymbol) |
| 234 | |
| 235 | if (!display) throw new Error('Could not find Vuetify display injection') |
| 236 | |
| 237 | const mobile = computed(() => { |
| 238 | if (props.mobile) { |
| 239 | return true |
| 240 | } else if (typeof props.mobileBreakpoint === 'number') { |
| 241 | return display.width.value < props.mobileBreakpoint |
| 242 | } else if (props.mobileBreakpoint) { |
| 243 | return display.width.value < display.thresholds.value[props.mobileBreakpoint] |
| 244 | } else if (props.mobile === null) { |
| 245 | return display.mobile.value |
| 246 | } else { |
| 247 | return false |
| 248 | } |
| 249 | }) |
| 250 | |
| 251 | const displayClasses = toRef(() => { |
| 252 | if (!name) return {} |
| 253 | |
| 254 | return { [`${name}--mobile`]: mobile.value } |
| 255 | }) |
| 256 | |
| 257 | return { ...display, displayClasses, mobile } |
| 258 | } |
no test coverage detected
searching dependent graphs…