zydx-plus 1.19.96 → 1.19.97

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.19.96",
3
+ "version": "1.19.97",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -15,7 +15,8 @@
15
15
  <div v-if="type === 'radio'">
16
16
  <div class="radio-list" v-for="(item,index) in radioArr" :key="index">
17
17
  <label>
18
- <input type="radio" name="radio" :value="item.value" :checked="item.checked" @change="radioTao(index)" />
18
+ <input type="radio" name="radio" :value="item.value" :checked="item.checked"
19
+ @change="radioTao(index)"/>
19
20
  <span>{{ item.label }}</span>
20
21
  </label>
21
22
  </div>
@@ -23,8 +24,15 @@
23
24
  <div class="tip-img" v-if="type === 'input'">
24
25
  <div class="tip-input" v-for="(item,index) in inputArr" :key="index">
25
26
  <span v-if="item.name">{{ item.name }}</span>
26
- <input v-if="item.type === 'input'" type="text" :placeholder="item.placeholder"
27
- v-model="item.value" :disabled="item.disabled"/>
27
+ <div style="display: inline-block;" v-if="item.type === 'input'">
28
+ <input v-if="!item.number" type="text" :placeholder="item.placeholder"
29
+ v-model="item.value" :disabled="item.disabled"/>
30
+ <div v-else class="number-input">
31
+ <input type="number" @keypress="isNumberKey($event,index)"
32
+ :placeholder="item.placeholder"
33
+ v-model="item.value" :disabled="item.disabled"/>
34
+ </div>
35
+ </div>
28
36
  <div style="display: inline-block;">
29
37
  <Select v-if="item.type === 'select'" :options="item.option"
30
38
  v-model:value="item.selectValue"></Select>
@@ -36,8 +44,11 @@
36
44
  </div>
37
45
  <div v-if="item.type === 'text'" class="text">{{ item.value }}</div>
38
46
  <div v-if="item.type === 'code'" class="ph-code">
39
- <input type="text" v-model="item.value" :placeholder="item.placeholder" />
40
- <button ref="tipID" @click="item.codeTap($refs.tipID[0],inputArr)">{{ item.butVal }}</button>
47
+ <input type="text" v-model="item.value" :placeholder="item.placeholder"/>
48
+ <button ref="tipID" @click="item.codeTap($refs.tipID[0],inputArr)">{{
49
+ item.butVal
50
+ }}
51
+ </button>
41
52
  </div>
42
53
  </div>
43
54
  </div>
@@ -55,6 +66,20 @@
55
66
  <script>
56
67
  import Select from '../../select/src/select.vue'
57
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
+
58
83
 
59
84
  export default {
60
85
  name: 'zydx-tip-box',
@@ -110,7 +135,31 @@ export default {
110
135
  }
111
136
  },
112
137
  methods: {
113
- radioTao(index){
138
+ isNumberKey(evt,index) {
139
+ const charCode = (evt.which) ? evt.which : event.keyCode;
140
+ if (charCode === 46) {
141
+ if (this.inputArr[index].value.indexOf('.') !== -1)
142
+ evt.preventDefault();
143
+ else
144
+ return true;
145
+ } else if (charCode > 31 && (charCode < 48 || charCode > 57))
146
+ evt.preventDefault();
147
+
148
+ if (this.valueState(this.inputArr[index].value) && String.fromCharCode(charCode) === '0')
149
+ evt.preventDefault();
150
+ // 判断是否有小数点
151
+ if(this.inputArr[index].value === undefined) return true
152
+ if (this.inputArr[index].value.indexOf('.') !== -1) {
153
+ // 判断小数点的位数
154
+ if (this.inputArr[index].value.split('.')[1].length >= 1) {
155
+ evt.preventDefault();
156
+ }
157
+ }
158
+ },
159
+ valueState(v) {
160
+ return v === '' || v === undefined || v === null;
161
+ },
162
+ radioTao(index) {
114
163
  this.radioArr.forEach(item => {
115
164
  item.checked = false
116
165
  })
@@ -100,6 +100,7 @@ font-size: 12px;
100
100
  line-height: 30px;
101
101
  padding-right: 10px;
102
102
  text-align: right;
103
+ float: left;
103
104
  }
104
105
  .tip-input input{
105
106
  width: 211px;
@@ -167,4 +168,21 @@ font-size: 12px;
167
168
  top: 12px;
168
169
  left: 20px;
169
170
  z-index: 1;
171
+ }
172
+ .number-input{
173
+ width: 211px;
174
+ height: 32px;
175
+ box-sizing: border-box;
176
+ font-size: 16px;
177
+ outline: none;
178
+ border: 1px solid #ccc;
179
+ border-radius: 3px;
180
+ box-shadow: 0 1px 0 1px rgb(0 0 0 / 4%);
181
+ overflow: hidden;
182
+ }
183
+ .number-input>input{
184
+ border: 0 !important;
185
+ box-shadow: none !important;
186
+ height: 30px !important;
187
+ width: 240px !important;
170
188
  }
package/src/index.js CHANGED
@@ -57,7 +57,7 @@ function install(app) {
57
57
  }
58
58
 
59
59
  export default {
60
- version: '1.19.96',
60
+ version: '1.19.97',
61
61
  install,
62
62
  Calendar,
63
63
  Message,