初始化
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
<!-- label 为字段名 -->
|
||||
<!-- type 为输入框类型 默认text
|
||||
maxlength 为长度默认不限
|
||||
<!-- isBorder 是否有边框 默认 true有-->
|
||||
-->
|
||||
<template>
|
||||
<view class="input-box" :class="isBorder ? '' : 'border-none'">
|
||||
<view class="label"> <text class="tex">*</text> {{ label }}</view>
|
||||
<input class="iput" :type="text" :value="sea" @input="onClickInput" :placeholder="'请输入' + label" :maxlength="maxlength" placeholder-style="font-size: 28rpx; color:#999999" >
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { watch } from "vue";
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
default: ''
|
||||
},
|
||||
label: {
|
||||
default: ''
|
||||
},
|
||||
type: {
|
||||
default: 'text'
|
||||
},
|
||||
maxlength: {
|
||||
default: -1
|
||||
},
|
||||
isBorder: {
|
||||
default: true
|
||||
}
|
||||
|
||||
},
|
||||
name:"input-li",
|
||||
data() {
|
||||
return {
|
||||
sea: ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// console.log(this.value)
|
||||
this.sea = this.value
|
||||
},
|
||||
watch: {
|
||||
value: (val) => {
|
||||
// console.log(val)
|
||||
// this.sea = val
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickInput(e) {
|
||||
this.$emit('input', e.target.value)
|
||||
},
|
||||
onClickName() {
|
||||
this.$emit('click', 'name')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* emits */
|
||||
// const emits = emits(['update:modelValue', 'click'])
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.input-box{
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
padding: 0 16rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
border-bottom: 2rpx dashed #D9D9D9;
|
||||
.label{
|
||||
width: 200rpx;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
.tex{
|
||||
display: block;
|
||||
color: #E14343;
|
||||
margin-right: 8rpx;
|
||||
line-height: 40rpx;
|
||||
width: 14rpx;
|
||||
}
|
||||
}
|
||||
.iput{
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
}
|
||||
.border-none{
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user