This commit is contained in:
杨鹏
2025-10-11 16:06:53 +08:00
parent 0f450c6691
commit 09f8815234
24 changed files with 926 additions and 832 deletions
+37 -38
View File
@@ -7,15 +7,15 @@
<view
class="uni-easyinput__content"
:class="{
'is-input-border': inputBorder,
'is-input-error-border': inputBorder && msg,
'is-textarea': type === 'textarea',
'is-disabled': disabled
}"
'is-input-border': inputBorder,
'is-input-error-border': inputBorder && msg,
'is-textarea': type === 'textarea',
'is-disabled': disabled,
}"
:style="{
'border-color': inputBorder && msg ? '#dd524d' : styles.borderColor,
'background-color': disabled ? styles.disableColor : ''
}"
'border-color': inputBorder && msg ? '#dd524d' : styles.borderColor,
'background-color': disabled ? styles.disableColor : '',
}"
>
<uni-icons
v-if="prefixIcon"
@@ -48,10 +48,9 @@
:type="type === 'password' ? 'text' : type"
class="uni-easyinput__content-input"
:style="{
'padding-right': type === 'password' || clearable || prefixIcon ? '' : '10px',
'padding-left': paddingLeft + 'px'
}"
'padding-right': type === 'password' || clearable || prefixIcon ? '' : '10px',
'padding-left': paddingLeft + 'px',
}"
:name="name"
:value="val"
:password="!showPassword && type === 'password'"
@@ -159,7 +158,7 @@
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm'],
model: {
prop: 'modelValue',
event: 'update:modelValue'
event: 'update:modelValue',
},
props: {
name: String,
@@ -167,57 +166,57 @@
modelValue: [Number, String],
type: {
type: String,
default: 'text'
default: 'text',
},
clearable: {
type: Boolean,
default: true
default: true,
},
autoHeight: {
type: Boolean,
default: false
default: false,
},
placeholder: String,
placeholderStyle: String,
focus: {
type: Boolean,
default: false
default: false,
},
disabled: {
type: Boolean,
default: false
default: false,
},
maxlength: {
type: [Number, String],
default: 140
default: 140,
},
confirmType: {
type: String,
default: 'done'
default: 'done',
},
clearSize: {
type: [Number, String],
default: 15
default: 15,
},
inputBorder: {
type: Boolean,
default: true
default: true,
},
prefixIcon: {
type: String,
default: ''
default: '',
},
suffixIcon: {
type: String,
default: ''
default: '',
},
trim: {
type: [Boolean, String],
default: true
default: true,
},
passwordIcon: {
type: Boolean,
default: true
default: true,
},
styles: {
type: Object,
@@ -225,18 +224,18 @@
return {
color: '#333',
disableColor: '#F7F6F6',
borderColor: '#e5e5e5'
borderColor: '#e5e5e5',
};
}
},
},
errorMessage: {
type: [String, Boolean],
default: ''
default: '',
},
paddingLeft:{
paddingLeft: {
type: [Number, String],
default: 0
}
default: 0,
},
},
data() {
return {
@@ -247,7 +246,7 @@
border: false,
isFirstBorder: false,
showClearIcon: false,
showPassword: false
showPassword: false,
};
},
computed: {
@@ -257,7 +256,7 @@
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
inputMaxlength() {
return Number(this.maxlength);
}
},
},
watch: {
value(newVal) {
@@ -281,7 +280,7 @@
this.$nextTick(() => {
this.focused = this.focus;
});
}
},
},
created() {
if (!this.value && this.value !== 0) {
@@ -389,8 +388,8 @@
return str;
}
return str;
}
}
},
},
};
</script>
@@ -529,7 +528,7 @@
}
.is-disabled {
border-color: red;
border-color: #9251eb;
background-color: #f7f6f6;
color: #d5d5d5;
.uni-easyinput__placeholder-class {