|
@@ -17,7 +17,7 @@
|
|
|
<view class="nut-short-password-title">{{ title || translate('title') }}</view>
|
|
<view class="nut-short-password-title">{{ title || translate('title') }}</view>
|
|
|
<view class="nut-short-password-subtitle">{{ desc || translate('desc') }}</view>
|
|
<view class="nut-short-password-subtitle">{{ desc || translate('desc') }}</view>
|
|
|
<div class="nut-short-password-wrapper">
|
|
<div class="nut-short-password-wrapper">
|
|
|
- <view class="nut-short-password__list" @touchstart="focus">
|
|
|
|
|
|
|
+ <view class="nut-short-password__list" @touchstart="onTouchStart">
|
|
|
<view class="nut-short-password__item" v-for="(sublen, index) in new Array(comLen)" v-bind:key="index">
|
|
<view class="nut-short-password__item" v-for="(sublen, index) in new Array(comLen)" v-bind:key="index">
|
|
|
<view class="nut-short-password__item-icon" v-if="String(realInput).length > index"></view>
|
|
<view class="nut-short-password__item-icon" v-if="String(realInput).length > index"></view>
|
|
|
</view>
|
|
</view>
|
|
@@ -84,10 +84,10 @@ export default create({
|
|
|
const comLen = computed(() => range(Number(props.length)));
|
|
const comLen = computed(() => range(Number(props.length)));
|
|
|
const show = ref(props.visible);
|
|
const show = ref(props.visible);
|
|
|
// 方法
|
|
// 方法
|
|
|
- function focus(event: any) {
|
|
|
|
|
|
|
+ const onTouchStart = (event: TouchEvent) => {
|
|
|
event.stopPropagation();
|
|
event.stopPropagation();
|
|
|
emit('focus');
|
|
emit('focus');
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
watch(
|
|
watch(
|
|
|
() => props.visible,
|
|
() => props.visible,
|
|
|
(value) => {
|
|
(value) => {
|
|
@@ -103,20 +103,20 @@ export default create({
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
- function close() {
|
|
|
|
|
|
|
+ const close = () => {
|
|
|
emit('update:visible', false);
|
|
emit('update:visible', false);
|
|
|
emit('close');
|
|
emit('close');
|
|
|
- }
|
|
|
|
|
- function range(val: number) {
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+ const range = (val: number) => {
|
|
|
return Math.min(Math.max(4, val), 6);
|
|
return Math.min(Math.max(4, val), 6);
|
|
|
- }
|
|
|
|
|
- function onTips() {
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+ const onTips = () => {
|
|
|
emit('tips');
|
|
emit('tips');
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
return {
|
|
return {
|
|
|
comLen,
|
|
comLen,
|
|
|
realInput,
|
|
realInput,
|
|
|
- focus,
|
|
|
|
|
|
|
+ onTouchStart,
|
|
|
range,
|
|
range,
|
|
|
close,
|
|
close,
|
|
|
onTips,
|
|
onTips,
|