@neatui/nuxt 1.6.9 → 1.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<input
|
|
18
18
|
:title="props.modelValue"
|
|
19
19
|
:value="props.modelValue"
|
|
20
|
-
:type="
|
|
20
|
+
:type="inputType"
|
|
21
21
|
:placeholder="placeholder"
|
|
22
22
|
:disabled="disabled"
|
|
23
23
|
:readonly="readonly"
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
</slot>
|
|
31
31
|
<div ui-form-suffix="">
|
|
32
32
|
<i ui-form-clean="" v-if="clearable && props.modelValue && !readonly && !disabled" @click.stop="clear"></i>
|
|
33
|
+
<div
|
|
34
|
+
class="o-ls"
|
|
35
|
+
v-if="type === 'password' && cipher"
|
|
36
|
+
:ui-form-cipher="cipherVisible ? '1' : ''"
|
|
37
|
+
@click.stop="toggleCipher"
|
|
38
|
+
></div>
|
|
33
39
|
<slot name="suffix"></slot>
|
|
34
40
|
<template v-for="(item, idx) in suffix" :key="idx">
|
|
35
41
|
<div v-if="isObject(item)" v-bind="item.attrs" v-on="event(item, props.modelValue)">
|
|
@@ -43,7 +49,7 @@
|
|
|
43
49
|
</template>
|
|
44
50
|
|
|
45
51
|
<script setup lang="ts">
|
|
46
|
-
import { reactive, watch } from 'vue';
|
|
52
|
+
import { computed, reactive, ref, watch } from 'vue';
|
|
47
53
|
import { isObject, isFunction } from '@fekit/utils';
|
|
48
54
|
|
|
49
55
|
const emits = defineEmits(['update:modelValue', 'click', 'blur', 'focus', 'change', 'input', 'clear']);
|
|
@@ -65,6 +71,7 @@
|
|
|
65
71
|
* disabled 是否禁用
|
|
66
72
|
* readonly 是否只读
|
|
67
73
|
* clearable 是否显示清除按钮
|
|
74
|
+
* cipher 密码框是否显示明密文切换
|
|
68
75
|
* rules 校验规则
|
|
69
76
|
* verify 是否显示校验
|
|
70
77
|
* prefix 前缀内容
|
|
@@ -89,6 +96,7 @@
|
|
|
89
96
|
disabled?: boolean;
|
|
90
97
|
readonly?: boolean;
|
|
91
98
|
clearable?: boolean;
|
|
99
|
+
cipher?: boolean;
|
|
92
100
|
verify?: boolean;
|
|
93
101
|
prefix?: Array<any>;
|
|
94
102
|
suffix?: Array<any>;
|
|
@@ -110,6 +118,7 @@
|
|
|
110
118
|
disabled: false,
|
|
111
119
|
readonly: false,
|
|
112
120
|
clearable: true,
|
|
121
|
+
cipher: true,
|
|
113
122
|
verify: false,
|
|
114
123
|
prefix: () => [],
|
|
115
124
|
suffix: () => [],
|
|
@@ -124,6 +133,14 @@
|
|
|
124
133
|
// 错误
|
|
125
134
|
error: {},
|
|
126
135
|
});
|
|
136
|
+
const cipherVisible = ref(false);
|
|
137
|
+
|
|
138
|
+
const inputType = computed(() => {
|
|
139
|
+
if (props.type === 'password') {
|
|
140
|
+
return cipherVisible.value ? 'text' : 'password';
|
|
141
|
+
}
|
|
142
|
+
return props.type;
|
|
143
|
+
});
|
|
127
144
|
// 外部传入交互标识,主要用于外部没有输入但点击了提交,或表单提交成功后重置状态
|
|
128
145
|
watch(
|
|
129
146
|
() => props.interacted,
|
|
@@ -199,6 +216,11 @@
|
|
|
199
216
|
emits('update:modelValue', null);
|
|
200
217
|
emits('clear');
|
|
201
218
|
}
|
|
219
|
+
|
|
220
|
+
const toggleCipher = () => {
|
|
221
|
+
if (props.disabled || props.readonly) return;
|
|
222
|
+
cipherVisible.value = !cipherVisible.value;
|
|
223
|
+
};
|
|
202
224
|
// 输入
|
|
203
225
|
const input = (e: any) => {
|
|
204
226
|
// 用户交互
|
|
File without changes
|