Content-Length: 356088 | pFad | http://github.com/vueuse/vueuse/pull/4884/commits/50349e29b52586a45c0a3bafc4b696497bcd13c4

C7 docs: inline Key components in useMagicKeys and useKeyModifier demos by broBinChen · Pull Request #4884 · vueuse/vueuse · GitHub
Skip to content

docs: inline Key components in useMagicKeys and useKeyModifier demos #4884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
docs: inline Key components in useMagicKeys and useKeyModifier demos
  • Loading branch information
xiaobin committed Jul 16, 2025
commit 50349e29b52586a45c0a3bafc4b696497bcd13c4
21 changes: 20 additions & 1 deletion packages/core/useKeyModifier/demo.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
<script setup lang="ts">
import { useKeyModifier } from '@vueuse/core'
import Key from '../useMagicKeys/Key.vue'
import { defineComponent, h } from 'vue'

const capsLock = useKeyModifier('CapsLock')
const numLock = useKeyModifier('NumLock')
const scrollLock = useKeyModifier('ScrollLock')
const shift = useKeyModifier('Shift')
const control = useKeyModifier('Control')
const alt = useKeyModifier('Alt')

const Key = defineComponent({
props: {
value: {
type: Boolean,
required: true,
},
},
render() {
return h('div', {
class: [
'font-mono px-4 py-2 rounded',
this.value
? 'opacity-100 text-primary bg-primary bg-opacity-15'
: 'opacity-50 bg-gray-600 bg-opacity-10 dark:(bg-gray-400 bg-opacity-10)',
],
}, this.$slots.default?.())
},
})
</script>

<template>
Expand Down
17 changes: 0 additions & 17 deletions packages/core/useMagicKeys/Key.vue

This file was deleted.

22 changes: 20 additions & 2 deletions packages/core/useMagicKeys/demo.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
<script setup lang="ts">
import { useMagicKeys } from '@vueuse/core'
import { computed } from 'vue'
import Key from './Key.vue'
import { computed, defineComponent, h } from 'vue'

const { shift, v, u, e, s, v_u_e, u_s_e, current } = useMagicKeys()
const keys = computed(() => Array.from(current))

const Key = defineComponent({
props: {
value: {
type: Boolean,
required: true,
},
},
render() {
return h('div', {
class: [
'font-mono px-4 py-2 rounded',
this.value
? 'opacity-100 text-primary bg-primary bg-opacity-15'
: 'opacity-50 bg-gray-600 bg-opacity-10 dark:(bg-gray-400 bg-opacity-10)',
],
}, this.$slots.default?.())
},
})
</script>

<template>
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/vueuse/vueuse/pull/4884/commits/50349e29b52586a45c0a3bafc4b696497bcd13c4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy