Created
March 24, 2022 07:20
-
-
Save MinSomai/6eee7cb0cfc7222f14becb804e3abbf3 to your computer and use it in GitHub Desktop.
Vue show viewport height and width in title for debugging with vueuse
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
<script> | |
import { ref, computed, onMounted } from "@vue/composition-api"; | |
import { useWindowSize, useTitle } from "@vueuse/core"; | |
export default { | |
setup() { | |
const { width, height } = useWindowSize(); | |
const title = computed(() => { | |
return `w: ${width.value} h: ${height.value}`; | |
}); | |
useTitle(title); | |
return {}; | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment