|
@@ -5,9 +5,28 @@
|
|
|
<div class="iptWrap">
|
|
|
<!-- <input class="contentVal" type="number" :placeholder="content.placeholder" pattern="\d*" v-model="txt" @input="changeVal" @blur="blur" @click="handleClick"> -->
|
|
|
<!-- <input ref="ipt" class="contentVal" :placeholder="content.placeholder" pattern="[0-9]*" v-model="txt" @input="changeVal" @blur="blur" @click="handleClick"> -->
|
|
|
- <input ref="ipt" type="tel" class="contentVal" :placeholder="content.placeholder" v-model="txt" @input="changeVal" @blur="blur" @click="handleClick">
|
|
|
+ <!-- <input ref="ipt" type="tel" :placeholder="content.placeholder" v-model="txt" @input="changeVal" @blur="blur" @click="handleClick"> -->
|
|
|
<!-- <input v-for="(item,index) in content.iptList" type="tel" class="contentVal" :placeholder="content.placeholder" v-model="txt" @input="changeVal" @blur="blur" @click="handleClick"> -->
|
|
|
-
|
|
|
+ <template v-for="(item,idx) in content.iptLis">
|
|
|
+ <input v-if="content.iptLis.length>1"
|
|
|
+ class="contentVal"
|
|
|
+ :type="content.type=='number'?'tel':'text'"
|
|
|
+ :style="{'width':1/content.iptLis.length*100-3+'%'}"
|
|
|
+ :key="item.placeholder+idx"
|
|
|
+ v-model="item.value"
|
|
|
+ :placeholder="item.placeholder"
|
|
|
+ @input="changeVal($event,idx)"
|
|
|
+ @blur="blur"
|
|
|
+ @click="handleClick">
|
|
|
+ <input v-show="content.iptLis.length==1" class="contentVal"
|
|
|
+ :type="content.type=='number'?'tel':'text'"
|
|
|
+ :placeholder="content.placeholder"
|
|
|
+ v-model="item.value"
|
|
|
+ @input="changeVal($event,idx)"
|
|
|
+ @blur="blur"
|
|
|
+ @click="handleClick">
|
|
|
+ <span v-if="idx == 0&&content.iptLis.length>1">/</span>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</div>
|
|
|
<span class="suffix" v-if="content.suffix">{{content.suffix}}</span>
|
|
@@ -43,14 +62,28 @@ export default {
|
|
|
return {
|
|
|
content:{},
|
|
|
txt:this.part.value || '', //回读用
|
|
|
+ tmpArr:[]
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
|
- this.content = getModelExpStr(this.msg)
|
|
|
+ this.setValue()
|
|
|
},
|
|
|
methods:{
|
|
|
- changeVal(){
|
|
|
- // this.$emit('changeMultipVal',this.txt)
|
|
|
+ changeVal(e,num){
|
|
|
+ let tmpTxt = '',arr=this.tmpArr
|
|
|
+ e.currentTarget.value=e.currentTarget.value.replace(/[^\d]/g,'')
|
|
|
+ arr[num]=e.currentTarget.value
|
|
|
+ tmpTxt=arr.join('/')
|
|
|
+ this.txt = tmpTxt
|
|
|
+ this.setValue()
|
|
|
+ // this.$emit('changeMultipVal',e.currentTarget.value,num)
|
|
|
+ },
|
|
|
+ setValue(){
|
|
|
+ if(this.txt){
|
|
|
+ this.content = getModelExpStr(this.msg,this.txt)
|
|
|
+ }else{
|
|
|
+ this.content = getModelExpStr(this.msg)
|
|
|
+ }
|
|
|
},
|
|
|
blur(){
|
|
|
// 如果该项未选中,则不存值
|
|
@@ -122,7 +155,7 @@ export default {
|
|
|
.suffix {
|
|
|
position: absolute;
|
|
|
right: .1rem;
|
|
|
- top: .1rem;
|
|
|
+ top: .2rem;
|
|
|
width: 1rem;
|
|
|
text-align: right;
|
|
|
text-align: left;
|