-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the wiring photo being shown when not defined and the item update…
… for other items always showing the first item
- Loading branch information
Showing
12 changed files
with
167 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {computed, ComputedRef, ref} from "vue"; | ||
const screens = { | ||
sm: 640, | ||
md: 768, | ||
lg: 1024, | ||
xl: 1280 | ||
} | ||
|
||
export enum Breakpoints { | ||
sm = 'sm', | ||
md = 'md', | ||
lg = 'lg', | ||
xl = 'xl', | ||
all = 'all' | ||
} | ||
const w = ref(window.innerWidth); | ||
|
||
const breakpoint = computed(()=>{ | ||
if ( w.value >= screens.sm && w.value <= screens.md ) return Breakpoints.sm | ||
else if (w.value >= screens.md && w.value <= screens.lg) return Breakpoints.md | ||
else if (w.value >= screens.lg && w.value <= screens.xl) return Breakpoints.lg | ||
else if (w.value >= screens.xl) return Breakpoints.xl | ||
else return Breakpoints.all | ||
}) | ||
const debounce = function(func: any, wait: number) { | ||
let timeout: number | undefined | ||
return () => { | ||
const later = function() { | ||
timeout = undefined | ||
} | ||
const callNow = !timeout | ||
if(timeout) { | ||
clearTimeout(timeout) | ||
} | ||
timeout = setTimeout(later, wait) | ||
if (callNow) func() | ||
} | ||
} | ||
|
||
window.addEventListener( | ||
'resize', | ||
debounce(() => { | ||
w.value = window.innerWidth | ||
}, 200), | ||
false | ||
) | ||
|
||
export default breakpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.