zydx-plus 1.19.97 → 1.19.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/tipBox/src/main.vue +8 -22
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
<div class="tip-input" v-for="(item,index) in inputArr" :key="index">
|
|
26
26
|
<span v-if="item.name">{{ item.name }}</span>
|
|
27
27
|
<div style="display: inline-block;" v-if="item.type === 'input'">
|
|
28
|
-
<
|
|
29
|
-
v-model="item.value" :disabled="item.disabled"/>
|
|
30
|
-
<div v-else class="number-input">
|
|
28
|
+
<div v-if="item.number" class="number-input">
|
|
31
29
|
<input type="number" @keypress="isNumberKey($event,index)"
|
|
32
30
|
:placeholder="item.placeholder"
|
|
33
31
|
v-model="item.value" :disabled="item.disabled"/>
|
|
34
32
|
</div>
|
|
33
|
+
<input v-else type="text" :placeholder="item.placeholder"
|
|
34
|
+
v-model="item.value" :disabled="item.disabled"/>
|
|
35
35
|
</div>
|
|
36
36
|
<div style="display: inline-block;">
|
|
37
37
|
<Select v-if="item.type === 'select'" :options="item.option"
|
|
@@ -66,20 +66,6 @@
|
|
|
66
66
|
<script>
|
|
67
67
|
import Select from '../../select/src/select.vue'
|
|
68
68
|
import Calendar from '../../calendar/src/Calendar'
|
|
69
|
-
function isNumberKey(evt) {
|
|
70
|
-
var charCode = (evt.which) ? evt.which : event.keyCode;
|
|
71
|
-
if (charCode === 46) {
|
|
72
|
-
// Check if the text already contains a decimal point
|
|
73
|
-
return evt.target.value.indexOf('.') === -1;
|
|
74
|
-
} else if (charCode > 31 && (charCode < 48 || charCode > 57))
|
|
75
|
-
return false;
|
|
76
|
-
|
|
77
|
-
// Check if the first character is zero
|
|
78
|
-
return !(evt.target.value === '' && String.fromCharCode(charCode) === '0');
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
69
|
|
|
84
70
|
export default {
|
|
85
71
|
name: 'zydx-tip-box',
|
|
@@ -137,8 +123,10 @@ export default {
|
|
|
137
123
|
methods: {
|
|
138
124
|
isNumberKey(evt,index) {
|
|
139
125
|
const charCode = (evt.which) ? evt.which : event.keyCode;
|
|
126
|
+
if(this.inputArr[index].value === undefined) return true
|
|
127
|
+
let val = this.inputArr[index].value.toString()
|
|
140
128
|
if (charCode === 46) {
|
|
141
|
-
if (
|
|
129
|
+
if (val.indexOf('.') !== -1)
|
|
142
130
|
evt.preventDefault();
|
|
143
131
|
else
|
|
144
132
|
return true;
|
|
@@ -148,10 +136,8 @@ export default {
|
|
|
148
136
|
if (this.valueState(this.inputArr[index].value) && String.fromCharCode(charCode) === '0')
|
|
149
137
|
evt.preventDefault();
|
|
150
138
|
// 判断是否有小数点
|
|
151
|
-
if(
|
|
152
|
-
|
|
153
|
-
// 判断小数点的位数
|
|
154
|
-
if (this.inputArr[index].value.split('.')[1].length >= 1) {
|
|
139
|
+
if (val.indexOf('.') !== -1) {
|
|
140
|
+
if (val[1].length >= 1) {
|
|
155
141
|
evt.preventDefault();
|
|
156
142
|
}
|
|
157
143
|
}
|