网页特效栏目收集了最全最新的前端网页插件,包括最流行的jQuery,Bootstrap,Js,Css,Vue等主流特效插件。
Vue 3 高度可定制的密码输入组件。
1、导入并注册otp-input组件。
// locally import VOtpInput from 'vue3-otp-input'; export default defineComponent({ components: { VOtpInput, }, });
// globally import { createApp } from 'vue' import App from './App.vue' import VOtpInput from "vue3-otp-input"; const app = createApp(App) app.component('v-otp-input', VOtpInput).mount('#app')
2.将v-otp-input
组件添加到模板中。
<v-otp-input ref="otpInput" input-classes="otp-input" separator="-" :num-inputs="4" :should-auto-focus="true" :is-input-num="true" @on-change="handleOnChange" @on-complete="handleOnComplete" />
3. 默认配置项。
numInputs: { default: 4, }, separator: { type: String, default: "**", }, inputClasses: { type: String, }, inputType: { type: String, validator: (value: string) => ["number", "tel", "password"].includes(value), }, shouldAutoFocus: { type: Boolean, default: false, }, placeholder: { type: Array, default: [], }, isDisabled: { type: Boolean, default: false, },
转载请注明来源:Vue 3 OTP Input 密码输入框输入组件
本文永久链接地址:https://www.moyouyouw.cn/code/24559.html
郑重声明:本站所有主题/文章除标明原创外,均来自网络转载,版权归原作者所有,如果有侵犯到您的权益,请联系本站删除,谢谢!我们不承担任何技术及版权问题,且不对任何资源负法律责任。
已有 位小伙伴发表了看法
欢迎 你 发表评论