@10yun/cv-mobile-ui 0.5.2 → 0.5.4

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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/ui-cv/{cv-button/cv-button.vue → cv-btn-base/cv-btn-base.vue} +19 -14
  3. package/ui-cv/cv-checkbox-group/cv-checkbox-group.vue +89 -56
  4. package/ui-cv/cv-checkbox-opt-base/cv-checkbox-opt-base.vue +43 -3
  5. package/ui-cv/cv-checkbox-opt-tag/cv-checkbox-opt-tag.vue +6 -2
  6. package/ui-cv/cv-code-sms/cv-code-sms.vue +6 -4
  7. package/ui-cv/cv-date-base/cv-date-base.vue +27 -6
  8. package/ui-cv/cv-datetime-base/cv-datetime-base.vue +15 -5
  9. package/ui-cv/cv-datetime5-base/cv-datetime5-base.vue +24 -7
  10. package/ui-cv/cv-dialog-share/cv-dialog-share.vue +2 -0
  11. package/ui-cv/cv-editor-quill/cv-editor-quill.vue +1 -0
  12. package/ui-cv/cv-form-base/cv-form-base.vue +1 -1
  13. package/ui-cv/cv-form-item/cv-form-item.vue +5 -2
  14. package/ui-cv/cv-geo-local/cv-geo-local.vue +118 -27
  15. package/ui-cv/{cv-picker-region/cv-picker-region.vue → cv-geo-region/cv-geo-region.vue} +32 -10
  16. package/ui-cv/cv-input-digit/cv-input-digit.vue +69 -6
  17. package/ui-cv/cv-input-idcard/cv-input-idcard.vue +70 -7
  18. package/ui-cv/cv-input-number/cv-input-number.vue +56 -6
  19. package/ui-cv/cv-input-password/cv-input-password.vue +66 -5
  20. package/ui-cv/cv-input-text/cv-input-text.vue +74 -7
  21. package/ui-cv/cv-picker1/cv-picker1.vue +35 -8
  22. package/ui-cv/cv-picker2/cv-picker2.vue +48 -23
  23. package/ui-cv/cv-picker3/cv-picker3.vue +69 -44
  24. package/ui-cv/cv-radio-group/cv-radio-group.vue +35 -13
  25. package/ui-cv/cv-radio-opt-base/cv-radio-opt-base.vue +37 -3
  26. package/ui-cv/cv-radio-opt-tag/cv-radio-opt-tag.vue +1 -1
  27. package/ui-cv/cv-rate/cv-rate.vue +10 -5
  28. package/ui-cv/cv-search/cv-search.vue +7 -1
  29. package/ui-cv/cv-switch/cv-switch.vue +24 -9
  30. package/ui-cv/cv-textarea/cv-textarea.vue +18 -5
  31. package/ui-cv/cv-time-base/cv-time-base.vue +30 -3
  32. package/ui-cv/cv-treaty/cv-treaty.vue +18 -13
  33. package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +12 -5
  34. package/ui-cv/cv-upload-image/cv-upload-image.vue +18 -7
  35. package/ui-cv/cv-input-btn/cv-input-btn.vue +0 -124
  36. package/ui-cv/mixins/mixins-input.js +0 -75
  37. package/ui-cv/mixins/mixins-picker.js +0 -34
@@ -30,9 +30,7 @@
30
30
  </template>
31
31
 
32
32
  <script>
33
- import MixinsInput from '../mixins/mixins-input.js';
34
33
  export default {
35
- mixins: [MixinsInput],
36
34
  name: 'cvInputPassword',
37
35
  inject: {
38
36
  cvFormGroup: {
@@ -42,23 +40,86 @@ export default {
42
40
  }
43
41
  },
44
42
  props: {
43
+ value: {
44
+ type: [Number, String],
45
+ default: ''
46
+ },
47
+ modelValue: {
48
+ type: [Number, String],
49
+ default: ''
50
+ },
45
51
  placeholder: {
46
52
  type: [String],
47
53
  default: '请输入密码'
48
54
  },
55
+ disabled: {
56
+ type: [Boolean],
57
+ default: false
58
+ },
59
+ clearable: {
60
+ type: [Boolean],
61
+ default: false
62
+ },
63
+ maxlength: {
64
+ type: [Number, String],
65
+ default: -1
66
+ },
49
67
  passwordIcon: {
50
68
  type: Boolean,
51
69
  default: true
52
70
  }
53
71
  },
54
- watch: {},
72
+ watch: {
73
+ value(newVal) {
74
+ this.localVal = newVal;
75
+ },
76
+ modelValue(newVal) {
77
+ this.localVal = newVal;
78
+ }
79
+ },
55
80
  data() {
56
81
  return {
82
+ localStyle: '',
83
+ localVal: '',
57
84
  showPassword: false
58
85
  };
59
86
  },
60
- created() {},
87
+ created() {
88
+ this.localVal = this.doValueGet();
89
+ },
90
+ mounted() {
91
+ this._itemStyle();
92
+ },
61
93
  methods: {
94
+ doValueGet() {
95
+ if (this.value === '') return this.modelValue;
96
+ if (this.modelValue === '') return this.value;
97
+ return this.value;
98
+ },
99
+ _itemStyle() {
100
+ /* 计算输入框右侧预留空间 */
101
+ let paddingRight = 0;
102
+ if (this.$slots['append']) {
103
+ paddingRight += 20;
104
+ }
105
+ if (this.clearable) {
106
+ paddingRight += 30;
107
+ }
108
+ this.localStyle = 'margin-right:' + paddingRight + 'px;';
109
+ },
110
+ onBlur(e) {
111
+ this.localVal = e.detail.value;
112
+ this.funcOnInput();
113
+ },
114
+ funcOnInput(e) {
115
+ this.$emit('input', this.localVal);
116
+ this.$emit('update:modelValue', this.localVal);
117
+ },
118
+ /* 监听自己清除按钮点击事件 */
119
+ onEmpty() {
120
+ this.localVal = '';
121
+ this.funcOnInput();
122
+ },
62
123
  onEyes() {
63
124
  this.showPassword = !this.showPassword;
64
125
  }
@@ -67,7 +128,7 @@ export default {
67
128
  </script>
68
129
  <style>
69
130
  .cv-input__content {
70
- height: 36px;
131
+ min-height: 36px;
71
132
  line-height: 36px;
72
133
  font-size: 14px;
73
134
  }
@@ -23,31 +23,98 @@
23
23
  </view>
24
24
  </view>
25
25
  </template>
26
-
27
26
  <script>
28
- import MixinsInput from '../mixins/mixins-input.js';
29
27
  export default {
30
- mixins: [MixinsInput],
31
28
  name: 'cvInputText',
32
29
  options: {
33
30
  addGlobalClass: true
34
31
  },
35
32
  props: {
33
+ value: {
34
+ type: [Number, String],
35
+ default: ''
36
+ },
37
+ modelValue: {
38
+ type: [Number, String],
39
+ default: ''
40
+ },
41
+ placeholder: {
42
+ type: [String],
43
+ default: '请输入'
44
+ },
45
+ clearable: {
46
+ type: [Boolean],
47
+ default: false
48
+ },
49
+ maxlength: {
50
+ type: [Number, String],
51
+ default: -1
52
+ },
53
+ disabled: {
54
+ type: [Boolean],
55
+ default: false
56
+ },
36
57
  placeholder: {
37
58
  type: [String],
38
59
  default: '请输入文本'
39
60
  }
40
61
  },
62
+ watch: {
63
+ value(newVal) {
64
+ this.localVal = newVal;
65
+ },
66
+ modelValue(newVal) {
67
+ this.localVal = newVal;
68
+ }
69
+ },
41
70
  data() {
42
- return {};
71
+ return {
72
+ localStyle: '',
73
+ localVal: ''
74
+ };
43
75
  },
44
- created() {},
45
- methods: {}
76
+ created() {
77
+ // this.localVal = this.doValueGet();
78
+ },
79
+ mounted() {
80
+ this._itemStyle();
81
+ },
82
+ methods: {
83
+ doValueGet() {
84
+ if (this.value === '') return this.modelValue;
85
+ if (this.modelValue === '') return this.value;
86
+ return this.value;
87
+ },
88
+ _itemStyle() {
89
+ /* 计算输入框右侧预留空间 */
90
+ let paddingRight = 0;
91
+ if (this.$slots['append']) {
92
+ paddingRight += 20;
93
+ }
94
+ if (this.clearable) {
95
+ paddingRight += 30;
96
+ }
97
+ this.localStyle = 'margin-right:' + paddingRight + 'px;';
98
+ },
99
+ onBlur(e) {
100
+ this.localVal = e.detail.value;
101
+ this.funcOnInput();
102
+ },
103
+ funcOnInput(e) {
104
+ this.$emit('input', this.localVal);
105
+ this.$emit('update:modelValue', this.localVal);
106
+ },
107
+ /* 监听自己清除按钮点击事件 */
108
+ onEmpty() {
109
+ this.localVal = '';
110
+ this.funcOnInput();
111
+ }
112
+ }
46
113
  };
47
114
  </script>
48
115
  <style>
49
116
  .cv-input__content {
50
- height: 36px;
117
+ min-height: 36px;
51
118
  line-height: 36px;
52
119
  font-size: 14px;
53
120
  }
@@ -16,16 +16,17 @@
16
16
  </template>
17
17
 
18
18
  <script>
19
- import MixinsPicker from '../mixins/mixins-picker.js';
20
19
  export default {
21
- mixins: [MixinsPicker],
22
20
  name: 'cvPicker1',
23
21
  props: {
24
- //默认输入框内容
25
22
  value: {
26
23
  type: [Number, String],
27
24
  default: ''
28
25
  },
26
+ modelValue: {
27
+ type: [Number, String],
28
+ default: ''
29
+ },
29
30
  dataType: {
30
31
  type: String,
31
32
  default: 'value'
@@ -44,6 +45,11 @@ export default {
44
45
  dataText: {
45
46
  type: String,
46
47
  default: 'text'
48
+ },
49
+ // 占位符
50
+ placeholder: {
51
+ type: String,
52
+ default: '请选择'
47
53
  }
48
54
  },
49
55
  data() {
@@ -53,6 +59,9 @@ export default {
53
59
  localArr: [],
54
60
  // 当前选中下标
55
61
  localIndex: null,
62
+ localDataType: 'text',
63
+ localDataValue: 'value',
64
+ localDataText: 'label',
56
65
  iconTop: false,
57
66
  pickerLists: []
58
67
  };
@@ -68,14 +77,24 @@ export default {
68
77
  value(newVal) {
69
78
  this.localVal = newVal;
70
79
  this._dealValue();
80
+ },
81
+ modelValue(newVal) {
82
+ this.localVal = newVal;
83
+ this._dealValue();
71
84
  }
72
85
  },
73
86
  created() {
74
- this.localVal = this.value;
87
+ this.localVal = this.doValueGet();
88
+ console.log(this.localVal);
75
89
  this.localArr = this.itemsSortOut();
76
90
  this._dealValue();
77
91
  },
78
92
  methods: {
93
+ doValueGet() {
94
+ if (this.value === '') return this.modelValue;
95
+ if (this.modelValue === '') return this.value;
96
+ return this.value;
97
+ },
79
98
  /**
80
99
  * 处理-循环数组数据
81
100
  */
@@ -102,14 +121,14 @@ export default {
102
121
  * 处理-选中
103
122
  */
104
123
  _dealValue() {
105
- this.dataType = this.dataType != 'text' ? 'value' : 'text';
124
+ this.localDataType = this.dataType != 'text' ? 'value' : 'text';
106
125
  //默认Value
107
126
  let tempArr = this.localArr;
108
127
  let localIndex = null;
109
128
  for (let index = 0; index < tempArr.length; index++) {
110
- if (this.dataType == 'text' && this.localVal == tempArr[index].text) {
129
+ if (this.localDataType == 'text' && this.localVal == tempArr[index].text) {
111
130
  localIndex = index;
112
- } else if (this.dataType == 'value' && this.localVal == tempArr[index].value) {
131
+ } else if (this.localDataType == 'value' && this.localVal == tempArr[index].value) {
113
132
  localIndex = index;
114
133
  }
115
134
  }
@@ -145,13 +164,21 @@ export default {
145
164
 
146
165
  this.localIndex = localIndex;
147
166
  const rowData = this.localArr[localIndex];
148
- if (this.dataType == 'text') {
167
+ if (this.localDataType == 'text') {
149
168
  this.localVal = rowData.text;
150
169
  } else {
151
170
  this.localVal = rowData.value;
152
171
  }
172
+ this.iconTop = false;
173
+ console.log(this.localVal);
153
174
  this.$emit('input', this.localVal);
175
+ this.$emit('update:modelValue', this.localVal);
176
+ },
177
+ bindPickerCancel() {
154
178
  this.iconTop = false;
179
+ },
180
+ changeIconTop() {
181
+ this.iconTop = true;
155
182
  }
156
183
  }
157
184
  };
@@ -21,17 +21,17 @@
21
21
  </picker>
22
22
  </view>
23
23
  </template>
24
-
25
24
  <script>
26
- import MixinsPicker from '../mixins/mixins-picker.js';
27
25
  export default {
28
- mixins: [MixinsPicker],
29
26
  name: 'cvPicker2',
30
27
  props: {
31
- //默认输入框内容
32
28
  value: {
33
- type: Array,
34
- default: []
29
+ type: [Array],
30
+ default: () => []
31
+ },
32
+ modelValue: {
33
+ type: [Array],
34
+ default: () => []
35
35
  },
36
36
  dataType: {
37
37
  type: String,
@@ -52,13 +52,18 @@ export default {
52
52
  type: String,
53
53
  default: 'text'
54
54
  },
55
- free: {
55
+ dataTree: {
56
56
  type: String,
57
- default: 'free'
57
+ default: 'tree'
58
58
  },
59
59
  joint: {
60
60
  type: String,
61
61
  default: ''
62
+ },
63
+ // 占位符
64
+ placeholder: {
65
+ type: String,
66
+ default: '请选择'
62
67
  }
63
68
  },
64
69
  watch: {
@@ -71,6 +76,10 @@ export default {
71
76
  value(newVal) {
72
77
  this.localVal = newVal;
73
78
  this.itemsSortOut();
79
+ },
80
+ modelValue(newVal) {
81
+ this.localVal = newVal;
82
+ this.itemsSortOut();
74
83
  }
75
84
  },
76
85
  data() {
@@ -83,15 +92,26 @@ export default {
83
92
  items_sub: [],
84
93
  items_index: [0, 0], //当前下标
85
94
  lastRetDataIndex: [0, 0], // 最终确定选中的下标
86
- localDataType: ''
95
+ localDataType: 'value',
96
+ localDataValue: 'value',
97
+ localDataText: 'label'
87
98
  };
88
99
  },
89
100
  created() {
90
- this.localVal = this.value.length != 2 ? [0, 0] : this.value;
101
+ this.localVal = this.doValueGet();
91
102
  this.localDataType = this.dataType != 'text' ? 'value' : 'text';
92
103
  this.itemsSortOut();
93
104
  },
94
105
  methods: {
106
+ doValueGet() {
107
+ if (this.value === '' || (Array.prototype.isPrototypeOf(this.value) && this.value.length === 0)) {
108
+ return this.modelValue.length != 2 ? [0, 0] : this.modelValue;
109
+ }
110
+ if (this.modelValue === '' || (Array.prototype.isPrototypeOf(this.modelValue) && this.modelValue.length === 0)) {
111
+ return this.value.length != 2 ? [0, 0] : this.value;
112
+ }
113
+ return this.value.length != 2 ? [0, 0] : this.value;
114
+ },
95
115
  itemsSortOut() {
96
116
  let original = [];
97
117
  original = this.dataLists || [];
@@ -107,13 +127,14 @@ export default {
107
127
  let items = [];
108
128
  let dataValue = this.dataValue ? this.dataValue : 'value';
109
129
  let dataText = this.dataText ? this.dataText : 'text';
110
- let free = this.free;
130
+
131
+ let tree = this.dataTree;
111
132
  let items_index = this.items_index;
112
133
  let dataType = this.localDataType;
113
134
  for (let i in original) {
114
135
  let data = original[i];
115
136
  //查找一级绑定参数
116
- if (this.localVal[0]) {
137
+ if (this.localVal && this.localVal.length >= 1) {
117
138
  if (dataType == 'text' && this.localVal[0] == data[dataText]) {
118
139
  items_index[0] = i;
119
140
  } else if (dataType == 'value' && this.localVal[0] == data[dataValue]) {
@@ -125,14 +146,14 @@ export default {
125
146
  value: data[dataValue].toString(),
126
147
  text: data[dataText]
127
148
  });
128
- if (original[i][free]) {
129
- let free_data = original[i][free];
149
+ if (original[i][tree]) {
150
+ let tree_data = original[i][tree];
130
151
  let temp = [];
131
- for (const ii in free_data) {
132
- let data = free_data[ii];
152
+ for (const ii in tree_data) {
153
+ let data = tree_data[ii];
133
154
 
134
155
  //查找二级绑定参数
135
- if (this.localVal[1]) {
156
+ if (this.localVal && this.localVal.length >= 2) {
136
157
  if (dataType == 'text' && this.localVal[1] == data[dataText]) {
137
158
  items_index[1] = ii;
138
159
  } else if (dataType == 'value' && this.localVal[1] == data[dataValue]) {
@@ -144,7 +165,7 @@ export default {
144
165
  text: data[dataText]
145
166
  });
146
167
  }
147
- items[i].free = temp;
168
+ items[i].tree = temp;
148
169
  }
149
170
  }
150
171
  if (!items) {
@@ -152,11 +173,11 @@ export default {
152
173
  }
153
174
  //默认Value
154
175
  this.items = items;
155
- this.items_sub = items[items_index[0] ?? 0].free;
176
+ this.items_sub = items[items_index[0] ?? 0].tree;
156
177
  this.range_data = [items, this.items_sub];
157
178
  this.last_range_data = [...this.range_data];
158
179
  this.items_index = items_index;
159
- if (this.value.length == 2) {
180
+ if (this.localVal && this.localVal.length == 2) {
160
181
  this.lastRetDataIndex = [...this.items_index];
161
182
  }
162
183
  },
@@ -166,6 +187,9 @@ export default {
166
187
  this.updateLocalVal();
167
188
  this.iconTop = false;
168
189
  },
190
+ changeIconTop() {
191
+ this.iconTop = true;
192
+ },
169
193
  /* 取消选择 */
170
194
  onCancel(e) {
171
195
  this.iconTop = false;
@@ -180,7 +204,7 @@ export default {
180
204
  items_index[0] = e.detail.value;
181
205
  items_index[1] = 0;
182
206
  let range_data = this.range_data;
183
- range_data[1] = range_data[0][items_index[0]].free;
207
+ range_data[1] = range_data[0][items_index[0]].tree;
184
208
  this.range_data = range_data;
185
209
  }
186
210
  this.items_index = items_index;
@@ -194,13 +218,14 @@ export default {
194
218
  let items = this.items;
195
219
  if (this.dataType == 'text') {
196
220
  value[0] = items[items_index[0]].text;
197
- value[1] = items[items_index[0]].free[items_index[1]].text;
221
+ value[1] = items[items_index[0]].tree[items_index[1]].text;
198
222
  } else {
199
223
  value[0] = items[items_index[0]].value;
200
- value[1] = items[items_index[0]].free[items_index[1]].value;
224
+ value[1] = items[items_index[0]].tree[items_index[1]].value;
201
225
  }
202
226
  this.localVal = value;
203
227
  this.$emit('input', value);
228
+ this.$emit('update:modelValue', value);
204
229
  }
205
230
  }
206
231
  };