Skip to content

Commit 9dcfaa6

Browse files
committed
Update: InputOTP code for presentation.
1 parent 730fbd1 commit 9dcfaa6

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

components/content/docs/components/inputOTP/InputOtpSeparator.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
InputOTPInputField,
88
Toast,
99
} from "~/src";
10-
import { defaultInputOTPCode } from "./inputOTPCode";
10+
import { inputOtpSeparatorCode } from "./inputOTPCode";
1111
1212
const value = ref<string[]>([]);
1313
@@ -17,7 +17,7 @@ const handleComplete = (e: string[]) => {
1717
</script>
1818

1919
<template>
20-
<CodeHighlightWithPreview :code="defaultInputOTPCode">
20+
<CodeHighlightWithPreview :code="inputOtpSeparatorCode">
2121
<div class="flex items-center justify-center">
2222
<InputOTP
2323
id="pin-input"

components/content/docs/components/inputOTP/inputOTPCode.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function handleComplete(e: string[]) {
1111
</script>
1212
1313
<template>
14-
<InputOTP id="pin-input" :model-value="value" @complete="handleComplete">
14+
<InputOTP id="pin-input" v-model="value" @complete="handleComplete">
1515
<InputOTPGroup>
1616
<template v-for="(id, index) in 5" :key="id">
1717
<InputOTPInputField :index="index" />
@@ -21,4 +21,41 @@ function handleComplete(e: string[]) {
2121
</template>`,
2222
};
2323

24-
export { defaultInputOTPCode };
24+
const inputOtpSeparatorCode = {
25+
"DefaultInputOTP.vue": `<script lang="ts" setup>
26+
import {
27+
InputOTP,
28+
InputOTPDivider,
29+
InputOTPGroup,
30+
InputOTPInputField,
31+
Toast,
32+
} from "keep-vue";
33+
import { defaultInputOTPCode } from "./inputOTPCode";
34+
35+
const value = ref<string[]>([]);
36+
37+
const handleComplete = (e: string[]) => {
38+
Toast(e.join(""));
39+
};
40+
</script>
41+
42+
<template>
43+
<InputOTP
44+
id="pin-input"
45+
v-model="value"
46+
placeholder="○"
47+
@complete="handleComplete">
48+
<InputOTPGroup>
49+
<template v-for="(id, index) in 5" :key="id">
50+
<InputOTPInputField :index="index" />
51+
<template v-if="index !== 4">
52+
<InputOTPDivider />
53+
</template>
54+
</template>
55+
</InputOTPGroup>
56+
</InputOTP>
57+
</template>
58+
`,
59+
};
60+
61+
export { defaultInputOTPCode, inputOtpSeparatorCode };

0 commit comments

Comments
 (0)