86 lines
2.4 KiB
Vue
86 lines
2.4 KiB
Vue
<template>
|
|
<view>
|
|
<block v-if="inputType == 'price'">
|
|
<input v-if="blurPrice" type="digit" :placeholder="'最小金额为:' + blurPrice" placeholder-class="placeholderClass" :value="blurValue" @blur="minInput($event, blurPrice)"/>
|
|
|
|
<input v-else type="digit" :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
<text>元</text>
|
|
</block>
|
|
<block v-else-if="inputType == 'number'">
|
|
<input type="number" :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
</block>
|
|
<block v-else-if="inputType == 'day'">
|
|
<input type="number" :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
<text>天</text>
|
|
</block>
|
|
<block v-else-if="inputType == 'password'">
|
|
<input type="text" password :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
</block>
|
|
<block v-else-if="inputType == 'mobile'">
|
|
<input type="number" maxlength="11" :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
</block>
|
|
<block v-else>
|
|
<input v-if="inputKey == 'card_no'" type="number" :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
<input v-else type="text" :placeholder="'请输入' + inputTitle" placeholder-class="placeholderClass" :value="blurValue" @blur="blurInput"/>
|
|
</block>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default{
|
|
name: 'mouldInput',
|
|
data(){
|
|
return {
|
|
workIndex: 0
|
|
}
|
|
},
|
|
props: {
|
|
inputKey: {
|
|
type : String,
|
|
default : ''
|
|
},
|
|
inputType: {
|
|
type : String,
|
|
default : ''
|
|
},
|
|
blurValue: {
|
|
type : String,
|
|
default : ''
|
|
},
|
|
inputTitle: {
|
|
type : String,
|
|
default : ''
|
|
},
|
|
blurPrice: {
|
|
type : String,
|
|
default : ''
|
|
}
|
|
},
|
|
onLoad() {},
|
|
methods: {
|
|
blurInput(e){
|
|
this.$emit('onValue', e.detail.value)
|
|
},
|
|
|
|
minInput(e, blurPrice){
|
|
if(parseInt(e.detail.value) < parseInt(blurPrice)) {
|
|
uni.showToast({
|
|
title: '最小值不可以小于' + blurPrice,
|
|
duration: 2000,
|
|
icon: 'none'
|
|
});
|
|
this.$emit('onValue', '')
|
|
return
|
|
}
|
|
this.$emit('onValue', e.detail.value)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
input {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style> |