-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(useClipboard): added a new composable (#709)
* feat(useClipboard): add `useClipboard` composable * feat(useClipboard): `useClipboard` composable * Update docs/composable/web/clipboard.md Co-authored-by: Carlos Rodrigues <[email protected]> * fix(useClipboard): Fixed docs example * chore(docs): added refresh button * types(event): more relax typescript window event * chore(clipboard): improvements * chore: add test and rename methods to be text * chore: added read and write Co-authored-by: Carlos Rodrigues <[email protected]>
- Loading branch information
Showing
14 changed files
with
365 additions
and
105 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,35 @@ | ||
<template> | ||
<div> | ||
<p>click the button to copy a random number</p> | ||
<button @click="copy">copy</button> | ||
<p>Check your dev tools to see what has been copied to your clipboard</p> | ||
|
||
<p>You can also change the clipboard</p> | ||
<input v-model="text" /> | ||
|
||
<div> | ||
<p>Current clipboard:</p> | ||
<p>{{ text }}</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useClipboard } from "vue-composable"; | ||
export default { | ||
setup() { | ||
const { text, writeText } = useClipboard(); | ||
function copy() { | ||
writeText(Math.random().toString()); | ||
console.log(text.value); | ||
} | ||
return { | ||
copy, | ||
text, | ||
}; | ||
}, | ||
}; | ||
</script> |
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
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.