feat: init short code ui
This commit is contained in:
@@ -168,12 +168,11 @@
|
|||||||
/>
|
/>
|
||||||
<SmartItem
|
<SmartItem
|
||||||
ref="copyRequest"
|
ref="copyRequest"
|
||||||
:label="`${$t('request.copy_link')}`"
|
:label="shareLink ? shareLink : `${$t('request.copy_link')}`"
|
||||||
:svg="hasNavigatorShare ? 'share-2' : 'copy'"
|
:svg="copyLinkIcon"
|
||||||
@click.native="
|
@click.native="
|
||||||
() => {
|
() => {
|
||||||
copyRequest()
|
copyRequest()
|
||||||
saveOptions.tippy().hide()
|
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
@@ -327,7 +326,12 @@ const clearContent = () => {
|
|||||||
resetRESTRequest()
|
resetRESTRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const copyLinkIcon = hasNavigatorShare ? ref("share-2") : ref("copy")
|
||||||
|
const shareLink = ref("")
|
||||||
|
|
||||||
const copyRequest = () => {
|
const copyRequest = () => {
|
||||||
|
shareLink.value = new URL(window.location.href).pathname
|
||||||
|
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
const time = new Date().toLocaleTimeString()
|
const time = new Date().toLocaleTimeString()
|
||||||
const date = new Date().toLocaleDateString()
|
const date = new Date().toLocaleDateString()
|
||||||
@@ -340,10 +344,12 @@ const copyRequest = () => {
|
|||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
} else {
|
} else {
|
||||||
|
copyLinkIcon.value = "check"
|
||||||
copyToClipboard(window.location.href)
|
copyToClipboard(window.location.href)
|
||||||
$toast.success(`${t("state.copied_to_clipboard")}`, {
|
$toast.success(`${t("state.copied_to_clipboard")}`, {
|
||||||
icon: "content_paste",
|
icon: "content_paste",
|
||||||
})
|
})
|
||||||
|
setTimeout(() => (copyLinkIcon.value = "copy"), 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user