|
@ -1,25 +1,12 @@ |
|
|
<template> |
|
|
<template> |
|
|
<el-form-item |
|
|
<el-form-item :style="{ height: height, ...styleObject }" |
|
|
:style="{height:height,...styleObject}" |
|
|
:class="[{ 'column': column }, { 'w510': addClass == 'w510' }, { 'w388': addClass == 'w388' }, 'form-item']" :label="label" |
|
|
:class="[{'column':column},{'w510':addClass=='w510'},{'w388':addClass=='w388'},'form-item']" |
|
|
:prop="prop" :rules="rules"> |
|
|
:label="label" :prop="prop" :rules="rules"> |
|
|
|
|
|
<p v-if="desc" class="desc_right">{{ desc }}</p> |
|
|
<p v-if="desc" class="desc_right">{{ desc }}</p> |
|
|
<el-input |
|
|
<el-input :type="type" v-bind="$attrs" :placeholder="placeholder1" :disabled="disabled" :maxlength="maxlength1" |
|
|
:type="type" |
|
|
:style="{ width: width, height: height }" :minLength="minLength1" :show-word-limit="showWordLimit" |
|
|
|
|
|
@input="$emit('input', $event)" @keydown="handleKeydown" @change="$emit('change', $event)" |
|
|
v-bind="$attrs" |
|
|
@blur="$emit('blur', inputValue)" @focus="$emit('focus', inputValue)" v-model="inputValue"> |
|
|
:placeholder="placeholder1" |
|
|
|
|
|
:disabled="disabled" |
|
|
|
|
|
:maxlength="maxlength1" |
|
|
|
|
|
:style="{width:width,height:height}" |
|
|
|
|
|
:minLength="minLength1" |
|
|
|
|
|
:show-word-limit="showWordLimit" |
|
|
|
|
|
@input="$emit('input', $event)" |
|
|
|
|
|
@keydown="handleKeydown" |
|
|
|
|
|
@change="$emit('change', $event)" |
|
|
|
|
|
@blur="$emit('blur', inputValue)" |
|
|
|
|
|
@focus="$emit('focus', inputValue)" |
|
|
|
|
|
v-model="inputValue"> |
|
|
|
|
|
<!-- 自定义前面小图标 --> |
|
|
<!-- 自定义前面小图标 --> |
|
|
<template v-slot:prepend> |
|
|
<template v-slot:prepend> |
|
|
<slot name="prependshow"></slot> |
|
|
<slot name="prependshow"></slot> |
|
@ -54,7 +41,7 @@ |
|
|
'label', 'type', 'prop', 'rules', 'column', 'addClass', 'desc', 'unit'], |
|
|
'label', 'type', 'prop', 'rules', 'column', 'addClass', 'desc', 'unit'], |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
inputValue: '', |
|
|
inputValue: this.value || this.defaultValue, |
|
|
maxlength1: '', |
|
|
maxlength1: '', |
|
|
minLength1: 0, |
|
|
minLength1: 0, |
|
|
style: { |
|
|
style: { |
|
@ -75,9 +62,9 @@ |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
// 默认值赋值 |
|
|
// 默认值赋值 |
|
|
if(this.defaultValue != null){ |
|
|
// if (this.defaultValue != null) { |
|
|
this.inputValue = this.defaultValue; |
|
|
// this.inputValue = this.defaultValue; |
|
|
} |
|
|
// } |
|
|
// 默认提示语 |
|
|
// 默认提示语 |
|
|
if (this.placeholder) { |
|
|
if (this.placeholder) { |
|
|
this.placeholder1 = this.placeholder; |
|
|
this.placeholder1 = this.placeholder; |
|
@ -147,9 +134,11 @@ |
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
.unit { |
|
|
.unit { |
|
|
position: absolute; |
|
|
position: absolute; |
|
|
right: 12px; /* 根据需要调整位置 */ |
|
|
right: 12px; |
|
|
|
|
|
/* 根据需要调整位置 */ |
|
|
top: 50%; |
|
|
top: 50%; |
|
|
transform: translateY(-50%); |
|
|
transform: translateY(-50%); |
|
|
pointer-events: none; /* 防止单位文本影响输入框的点击事件 */ |
|
|
pointer-events: none; |
|
|
|
|
|
/* 防止单位文本影响输入框的点击事件 */ |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |