Skip to content

Commit 6654674

Browse files
committed
feat: update demo page with separator
1 parent 6c7df64 commit 6654674

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/api.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const isAllowPaste = ref(false)
6969
const otpLength = ref(6)
7070
const currentOtpType = ref('text')
7171
const currentSeparator = ref('middle')
72+
const isAllowSeparator = ref(false)
7273

7374
const changeOnlyNumber = () => {
7475
otpInput.value.clear()
@@ -84,6 +85,8 @@ const changeOtpType = () => {
8485
}
8586

8687
const changeSeparator = () => currentSeparator.value = currentSeparator.value === "middle" ? "all" : "middle"
88+
89+
const changeAllowSeparator = () => isAllowSeparator.value = !isAllowSeparator.value
8790
</script>
8891
<label>Current OTP Length is: `{{ otpLength }}`</label> <br />
8992
<label><input type="checkbox" :checked="isOutlined" @change="isOutlined = !isOutlined"> Outlined</label>
@@ -93,6 +96,7 @@ const changeSeparator = () => currentSeparator.value = currentSeparator.value ==
9396
<label><input type="checkbox" :checked="isReadonly" @change="isReadonly = !isReadonly"> Readonly</label>
9497
<label><input type="checkbox" :checked="isAllowPaste" @change="isAllowPaste = !isAllowPaste"> AllowPaste</label> <br />
9598
<label><input type="checkbox" @change="changeOtpType"> OTP type: `{{ currentOtpType }}`</label> <br />
99+
<label><input type="checkbox" @change="changeAllowSeparator"> Allow separator: `{{ isAllowSeparator }}`</label> <br />
96100
<label><input type="checkbox" @change="changeSeparator"> Separator: `{{ currentSeparator }}`</label> <br />
97101

98102

@@ -115,7 +119,7 @@ const changeSeparator = () => currentSeparator.value = currentSeparator.value ==
115119
:readonly="isReadonly"
116120
:allowPaste="isAllowPaste"
117121
:separatorType="currentSeparator"
118-
separator="-"
122+
:separator="isAllowSeparator ? '-' : ''"
119123
/>
120124
<!-- Using
121125
<button @click="clearOtp">Clear OTP</button> -->

0 commit comments

Comments
 (0)