feat(ui): copy base api url button
This commit is contained in:
28
app.vue
28
app.vue
@@ -6,6 +6,7 @@ const form = ref(null);
|
|||||||
const qrCode = ref(undefined);
|
const qrCode = ref(undefined);
|
||||||
|
|
||||||
const copyUrlIcon = ref("i-heroicons-clipboard-document");
|
const copyUrlIcon = ref("i-heroicons-clipboard-document");
|
||||||
|
const copyBaseApiUrlIcon = ref("i-heroicons-clipboard-document");
|
||||||
const copyImageIcon = ref("i-heroicons-clipboard-document");
|
const copyImageIcon = ref("i-heroicons-clipboard-document");
|
||||||
const copyImageLabel = ref("Copy");
|
const copyImageLabel = ref("Copy");
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ const isValidState = computed(
|
|||||||
state.format,
|
state.format,
|
||||||
);
|
);
|
||||||
|
|
||||||
const BASE_API_URL = "http://localhost:3000/api";
|
const BASE_API_URL = "https://simple-qr.com/api";
|
||||||
|
|
||||||
const apiUrl = computed(() => {
|
const apiUrl = computed(() => {
|
||||||
if (!isValidState.value) return "";
|
if (!isValidState.value) return "";
|
||||||
@@ -71,6 +72,15 @@ const copyUrl = async () => {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyBaseApiUrl = async () => {
|
||||||
|
await navigator.clipboard.writeText(BASE_API_URL);
|
||||||
|
|
||||||
|
copyBaseApiUrlIcon.value = "i-heroicons-clipboard-document-check";
|
||||||
|
setTimeout(() => {
|
||||||
|
copyBaseApiUrlIcon.value = "i-heroicons-clipboard-document";
|
||||||
|
}, 3000);
|
||||||
|
};
|
||||||
|
|
||||||
const downloadQRCode = () => {
|
const downloadQRCode = () => {
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = qrCode.value;
|
link.href = qrCode.value;
|
||||||
@@ -120,7 +130,7 @@ const arrayToUnion = (array: string[]) =>
|
|||||||
Simple QRCode Generator
|
Simple QRCode Generator
|
||||||
</h1>
|
</h1>
|
||||||
<div class="flex justify-between space-x-8">
|
<div class="flex justify-between space-x-8">
|
||||||
<img :src="qrCodeSrc" class="max-h-[375px] aspect-square" />
|
<img :src="qrCodeSrc" class="max-h-[375px] aspect-square" >
|
||||||
|
|
||||||
<div class="flex-1 flex flex-col justify-center">
|
<div class="flex-1 flex flex-col justify-center">
|
||||||
<UForm ref="form" :state="state" class="space-y-4">
|
<UForm ref="form" :state="state" class="space-y-4">
|
||||||
@@ -276,16 +286,18 @@ const arrayToUnion = (array: string[]) =>
|
|||||||
<p>
|
<p>
|
||||||
You can easily generate QRCodes by using the API, with no rate
|
You can easily generate QRCodes by using the API, with no rate
|
||||||
limitation.
|
limitation.
|
||||||
<br />
|
<br >
|
||||||
<br />
|
<br >
|
||||||
If you are not sure how to use the API, you can fill the QRCode form
|
If you are not sure how to use the API, you can fill the QRCode form
|
||||||
and copy the generated API URL.
|
and copy the generated API URL.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<h2 class="font-bold text-lg">Base API URL</h2>
|
<h2 class="font-bold text-lg">Base API URL</h2>
|
||||||
|
|
||||||
|
<UButtonGroup size="sm" orientation="horizontal" class="w-full">
|
||||||
<UInput
|
<UInput
|
||||||
model-value="https://simple-qr.com/api"
|
:model-value="BASE_API_URL"
|
||||||
size="sm"
|
size="sm"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
disabled
|
disabled
|
||||||
@@ -298,6 +310,12 @@ const arrayToUnion = (array: string[]) =>
|
|||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</UInput>
|
</UInput>
|
||||||
|
<UButton
|
||||||
|
color="gray"
|
||||||
|
:icon="copyBaseApiUrlIcon"
|
||||||
|
@click="copyBaseApiUrl"
|
||||||
|
/>
|
||||||
|
</UButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user