From 233fdc1cc07df94e54036fa421addf1e17cdff83 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 28 二月 2024 10:58:12 +0800
Subject: [PATCH] #
---
components/z-input/z-input.vue | 55 +++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/components/z-input/z-input.vue b/components/z-input/z-input.vue
index 0e8f0dc..287ed1b 100644
--- a/components/z-input/z-input.vue
+++ b/components/z-input/z-input.vue
@@ -3,11 +3,18 @@
<view class="main">
<view class="inner1">{{desc}}</view>
<view class="put inner2">
+ <uni-icons class="p-icon"
+ type="scan"
+ size="16"
+ color="#a6a6a6"
+ @click="scanCode"
+ >
+ </uni-icons>
<input class="p-input"
type="text"
:placeholder="placeholder"
v-model="data"
- :focus="focusData">
+ :focus="focusData" @input="inputVal">
<uni-icons class="p-icon"
type="closeempty"
@@ -34,7 +41,15 @@
};
},
props: {
+ index: {
+ type: Number,
+ default: 0
+ },
desc: {
+ type: String,
+ default: ''
+ },
+ name: {
type: String,
default: ''
},
@@ -48,7 +63,7 @@
},
placeholder: {
type: String,
- default: '璇疯緭鍏�'
+ default: '鎵爜 / 褰曞叆'
},
value: {
type: [String,Number],
@@ -70,6 +85,7 @@
return
}
if (val.length != this.lenCheck) {
+ console.log(val);
setTimeout(()=>{
this.data = ''
this.$emit('input','')
@@ -78,8 +94,10 @@
this.$emit('input',val)
}
},
+ value(val) {
+ this.data = val
+ },
focus(f) {
- console.log(f);
this.focusData = !f
setTimeout(()=>{
this.focusData = f
@@ -96,6 +114,19 @@
},
clickBtn() {
this.$emit('clickBtn');
+ },
+ inputVal() {
+ this.$emit('inputVal',{title:this.name,value:this.data});
+ },
+ scanCode() {
+ let _this = this
+ uni.scanCode({
+ onlyFromCamera: true,
+ success(res) {
+ _this.data = res.result
+ _this.$emit('inputVal',{title:_this.name,value:_this.data})
+ }
+ })
}
}
}
@@ -105,9 +136,8 @@
.main {
display: flex;
align-items: center;
- min-height: 35px;
- background-color: #FFF;
- /* border-bottom: 1px solid darkgray; */
+ min-height: 50px;
+ background-color: #fff;
}
.put {
display: flex;
@@ -115,31 +145,32 @@
}
.inner1 {
- width: 65px;
+ width: 55px;
padding-left: 8px;
color: #606164;
font-weight: 900;
font-family:'Helvetica Neue';
}
.inner2 {
- background-color: #f1f3f4;
+ background-color: #f8f8f8;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
+ margin-right: 32rpx;
color: #606266;
}
.p-input {
flex:1;
- padding-left: 8px;
+ padding: 4px;
}
.p-icon {
- margin-left: 8px;
- margin-right: 8px;
+ margin-left: 4px;
+ margin-right: 4px;
}
.inner3 {
- width: 100px;
+ width: 90px;
display: flex;
align-items: center;
justify-content: center;
--
Gitblit v1.9.1