-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tabs): render all tabs when printing. (#50)
see: #49 --------- Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
- Loading branch information
1 parent
ac04097
commit 971574e
Showing
4 changed files
with
37 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'vitepress-plugin-tabs': minor | ||
--- | ||
|
||
render all tabs when printing |
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,19 @@ | ||
import { onBeforeMount, onUnmounted, ref } from 'vue' | ||
|
||
export const useIsPrint = () => { | ||
const matchMedia = | ||
typeof window !== 'undefined' ? window.matchMedia('print') : undefined | ||
const value = ref(matchMedia?.matches) | ||
|
||
const listener = () => { | ||
value.value = matchMedia?.matches | ||
} | ||
onBeforeMount(() => { | ||
matchMedia?.addEventListener('change', listener) | ||
}) | ||
onUnmounted(() => { | ||
matchMedia?.removeEventListener('change', listener) | ||
}) | ||
|
||
return value | ||
} |