mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
46 lines
949 B
Vue
46 lines
949 B
Vue
<template>
|
|
<div class="van-password-input">
|
|
<ul class="van-password-input__security van-hairline--surround" @touchstart.stop="$emit('focus')">
|
|
<li v-for="visibility in points" class="van-hairline">
|
|
<i :style="`visibility: ${visibility}`" />
|
|
</li>
|
|
</ul>
|
|
<div
|
|
v-if="errorInfo || info"
|
|
v-text="errorInfo || info"
|
|
:class="errorInfo ? 'van-password-input__error-info' : 'van-password-input__info'"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { create } from '../utils';
|
|
|
|
export default create({
|
|
name: 'van-password-input',
|
|
|
|
props: {
|
|
info: String,
|
|
errorInfo: String,
|
|
value: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
length: {
|
|
type: Number,
|
|
default: 6
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
points() {
|
|
const arr = [];
|
|
for (let i = 0; i < this.length; i++) {
|
|
arr[i] = this.value[i] ? 'visible' : 'hidden';
|
|
}
|
|
return arr;
|
|
}
|
|
}
|
|
});
|
|
</script>
|