Commit 8f3dc3c8 by 李少勇

修改基础组件placeholder的问题

parent c1c85b12
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
clearable clearable
ref="add" ref="add"
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:placeholder="placeholderEnable || placeholder || $t('components.请选择')"
></el-input> ></el-input>
<i class="date-pick-btn el-icon-date" > <i class="date-pick-btn el-icon-date" >
<el-date-picker <el-date-picker
...@@ -67,6 +68,10 @@ export default { ...@@ -67,6 +68,10 @@ export default {
type: String, type: String,
default: undefined default: undefined
}, },
placeholder:{
type: String,
default: null
},
// 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线 // 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线
markSetData: { markSetData: {
type: Object, type: Object,
...@@ -102,6 +107,14 @@ export default { ...@@ -102,6 +107,14 @@ export default {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
} }
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请选择') + ' ' + this.$t('components.' + label) : this.$t('components.请选择') + this.$t('components.' + label)
}
return curLabel
},
highlight() { highlight() {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
}, },
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
type="datetime" type="datetime"
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
v-on="$listeners" v-on="$listeners"
:placeholder="placeholderEnable || placeholder || $t('components.请选择')"
:value-format="valueFormat" :format="format" :value-format="valueFormat" :format="format"
@change="handleChange" @change="handleChange"
></el-date-picker> ></el-date-picker>
...@@ -42,6 +43,10 @@ export default { ...@@ -42,6 +43,10 @@ export default {
type: String, type: String,
default: undefined default: undefined
}, },
placeholder:{
type: String,
default: null
},
// 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线 // 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线
markSetData: { markSetData: {
type: Object, type: Object,
...@@ -69,6 +74,14 @@ export default { ...@@ -69,6 +74,14 @@ export default {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
} }
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请选择') + ' ' + this.$t('components.' + label) : this.$t('components.请选择') + this.$t('components.' + label)
}
return curLabel
},
highlight() { highlight() {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
}, },
......
<template> <template>
<el-date-picker :id="id" :class="{'highlight': highlight}" placeholder="选择日期" type="date" :picker-options="pickerOptions" v-model="model" v-bind="$attrs" <el-date-picker
:id="id" :class="{'highlight': highlight}"
:placeholder="placeholderEnable || placeholder || $t('components.请选择')"
type="date" :picker-options="pickerOptions" v-model="model" v-bind="$attrs"
v-on="$listeners" v-bind:disabled="isDisable" value-format="yyyyMMdd" format="yyyy-MM-dd"></el-date-picker> v-on="$listeners" v-bind:disabled="isDisable" value-format="yyyyMMdd" format="yyyy-MM-dd"></el-date-picker>
</template> </template>
...@@ -17,6 +20,10 @@ ...@@ -17,6 +20,10 @@
id: { id: {
type: String, type: String,
default: undefined default: undefined
},
placeholder:{
type: String,
default: null
} }
}, },
computed: { computed: {
...@@ -36,6 +43,14 @@ ...@@ -36,6 +43,14 @@
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
} }
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请选择') + ' ' + this.$t('components.' + label) : this.$t('components.请选择') + this.$t('components.' + label)
}
return curLabel
},
highlight () { highlight () {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
} }
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:maxlength="maxlength" :maxlength="maxlength"
:show-word-limit="isLimitChar ? false : showWordLimit" :show-word-limit="isLimitChar ? false : showWordLimit"
:placeholder="placeholderEnable || placeholder || $t('components.请输入')"
@change="handleChange" @change="handleChange"
:placeholder="placeholderEnable"
> >
<template v-slot:suffix> <template v-slot:suffix>
<slot name="suffix"></slot> <slot name="suffix"></slot>
...@@ -100,7 +100,12 @@ export default { ...@@ -100,7 +100,12 @@ export default {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
}, },
placeholderEnable(){ placeholderEnable(){
return this.isDisable?"":this.placeholder let label = this.$parent.label || this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请输入') + ' ' + this.$t('components.' + label) : this.$t('components.请输入') + this.$t('components.' + label)
}
return curLabel
}, },
highlight () { highlight () {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
v-on="$listeners" v-on="$listeners"
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:maxlength="maxlength" :maxlength="maxlength"
:placeholder="placeholderEnable || placeholder || $t('components.请输入')"
@blur="onBlur" @blur="onBlur"
@focus="focus" @focus="focus"
@change="handleChange" @change="handleChange"
...@@ -67,6 +68,10 @@ export default { ...@@ -67,6 +68,10 @@ export default {
type: String, type: String,
default: "" default: ""
}, },
placeholder:{
type: String,
default: null
},
// 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线 // 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线
markSetData: { markSetData: {
type: Object, type: Object,
...@@ -115,6 +120,14 @@ export default { ...@@ -115,6 +120,14 @@ export default {
isDisable() { isDisable() {
return this.mode === "display" || this.disabled; return this.mode === "display" || this.disabled;
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请输入') + ' ' + this.$t('components.' + label) : this.$t('components.请输入') + this.$t('components.' + label)
}
return curLabel
},
curPrecision() { curPrecision() {
if (this.currency === "KRW" || this.currency === "JPY") { if (this.currency === "KRW" || this.currency === "JPY") {
return 0 return 0
......
<template> <template>
<el-input :id="id" ref="form-item" v-model="model" type="textarea" v-bind="$attrs" v-on="$listeners" v-bind:disabled="isDisable" :rows="maxRows" resize="none" /> <el-input
:id="id" ref="form-item"
v-model="model" type="textarea"
v-bind="$attrs"
v-on="$listeners"
v-bind:disabled="isDisable"
:rows="maxRows"
resize="none"
:placeholder="placeholderEnable || placeholder || $t('components.请输入')"
/>
</template> </template>
<script> <script>
...@@ -24,25 +33,37 @@ export default { ...@@ -24,25 +33,37 @@ export default {
id: { id: {
type: String, type: String,
default: undefined default: undefined
} },
placeholder: {
type: String,
default: null
},
}, },
computed: { computed: {
model: { model: {
get () { get() {
let value = this.format(this.value) let value = this.format(this.value)
return value return value
}, },
set (newVal) { set(newVal) {
this.$emit('input', newVal) this.$emit('input', newVal)
} }
}, },
mode () { mode() {
return this.$store.state.Status.mode return this.$store.state.Status.mode
}, },
isDisable() { isDisable() {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
}, },
highlight () { placeholderEnable() {
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请输入') + ' ' + this.$t('components.' + label) : this.$t('components.请输入') + this.$t('components.' + label)
}
return curLabel
},
highlight() {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
} }
}, },
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:placeholder="placeholderEnable || placeholder || $t('components.请输入')"
@blur="blurEvent" @blur="blurEvent"
@change="handleChange" @change="handleChange"
/> />
...@@ -38,6 +39,10 @@ export default { ...@@ -38,6 +39,10 @@ export default {
type: String, type: String,
default: undefined default: undefined
}, },
placeholder:{
type: String,
default: null
},
// 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线 // 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线
markSetData: { markSetData: {
type: Object, type: Object,
...@@ -63,6 +68,14 @@ export default { ...@@ -63,6 +68,14 @@ export default {
isDisable() { isDisable() {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请输入') + ' ' + this.$t('components.' + label) : this.$t('components.请输入') + this.$t('components.' + label)
}
return curLabel
},
highlight () { highlight () {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
}, },
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:rows="maxRows" :rows="maxRows"
resize="none" resize="none"
:placeholder="placeholderEnable || placeholder || $t('components.请输入')"
@blur="blurEvent" @blur="blurEvent"
@change="handleChange" @change="handleChange"
/> />
...@@ -42,6 +43,10 @@ export default { ...@@ -42,6 +43,10 @@ export default {
type: Number, type: Number,
default: 3 default: 3
}, },
placeholder:{
type: String,
default: null
},
// 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线 // 此对象为markset或者modifySet所在的对象,如果传了此对象可以标记当前对象下的字段为红色下划线
markSetData: { markSetData: {
type: Object, type: Object,
...@@ -67,6 +72,14 @@ export default { ...@@ -67,6 +72,14 @@ export default {
isDisable() { isDisable() {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请输入') + ' ' + this.$t('components.' + label) : this.$t('components.请输入') + this.$t('components.' + label)
}
return curLabel
},
}, },
watch: { watch: {
disabled(newVal) { disabled(newVal) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
v-on="$listeners" v-on="$listeners"
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:autosize="autosize" :autosize="autosize"
:placeholder="placeholder" :placeholder="placeholderEnable || placeholder || $t('components.请输入')"
:show-word-limit="!isLimitChar && !isIgnoreLine" :show-word-limit="!isLimitChar && !isIgnoreLine"
:maxlength="rows * cols" :maxlength="rows * cols"
@blur="onBlur" @blur="onBlur"
...@@ -196,6 +196,14 @@ export default { ...@@ -196,6 +196,14 @@ export default {
isDisable() { isDisable() {
return this.mode === 'display' || this.disabled return this.mode === 'display' || this.disabled
}, },
placeholderEnable(){
let label = this.$parent.label
let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请输入') + ' ' + this.$t('components.' + label) : this.$t('components.请输入') + this.$t('components.' + label)
}
return curLabel
},
highlight () { highlight () {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1
}, },
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
v-bind:disabled="isDisable" v-bind:disabled="isDisable"
:clearable="clearable" :clearable="clearable"
v-on="$listeners" v-on="$listeners"
:placeholder="placeholderEnable" :placeholder="placeholderEnable || placeholder || $t('components.请选择')"
@change="handleChange" @change="handleChange"
@keyup.delete.native="deleteValue" @keyup.delete.native="deleteValue"
> >
...@@ -146,9 +146,14 @@ export default { ...@@ -146,9 +146,14 @@ export default {
isDisable() { isDisable() {
return this.mode === "display" || this.disabled; return this.mode === "display" || this.disabled;
}, },
placeholderEnable(){ placeholderEnable(){
return this.isDisable?"":this.placeholder let label = this.$parent.label
}, let curLabel = ''
if (label) {
curLabel = this.$i18n.locale === 'en' ? this.$t('components.请选择') + ' ' + this.$t('components.' + label) : this.$t('components.请选择') + this.$t('components.' + label)
}
return curLabel
},
highlight() { highlight() {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1; return this.$store.state.Status.highlights.indexOf(this.id) !== -1;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment