refactor: useClipboard 增加兼容性支持

This commit is contained in:
Hooray
2026-07-05 01:28:22 +08:00
parent fd33ab0c73
commit 06b0be9196
22 changed files with 22 additions and 22 deletions
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -38,7 +38,7 @@ onMounted(() => {
})
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
function handleCopy() {
copy(JSON.stringify(diffTwoObj(settingsDefault, appSettingsStore.settings), null, 2))
@@ -6,7 +6,7 @@ defineOptions({
})
const route = useRoute()
const { copy, copied } = useClipboard()
const { copy, copied } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success('复制成功')
})
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useClipboard } from '@vueuse/core'
const { text, copy, copied } = useClipboard()
const { text, copy, copied } = useClipboard({ legacy: true })
/* eslint-disable regexp/no-super-linear-backtracking, regexp/no-dupe-disjunctions, regexp/optimal-quantifier-concatenation, regexp/no-useless-assertions, regexp/no-contradiction-with-assertion, regexp/no-misleading-capturing-group */
const rules = ref([
@@ -14,7 +14,7 @@ const throttle = useThrottleFn(() => {
}, 1000)
const input = ref('test')
const { text, copy, copied, isSupported } = useClipboard()
const { text, copy, copied, isSupported } = useClipboard({ legacy: true })
watch(copied, (val) => {
val && useFaToast().success(text.value)
})
@@ -5,7 +5,7 @@ const props = defineProps<{
text: string
}>()
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
</script>
<template>
@@ -144,7 +144,7 @@ onMounted(async () => {
numberValue.value = 1234.5
})
const { copy, copied, isSupported } = useClipboard()
const { copy, copied, isSupported } = useClipboard({ legacy: true })
watch(copied, (val) => {
if (val) {