@10yun/cv-mobile-ui 0.5.3 → 0.5.5

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 (38) 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 +34 -24
  7. package/ui-cv/cv-date-base/cv-date-base.vue +27 -6
  8. package/ui-cv/cv-datetime-base/cv-datetime-base.vue +31 -7
  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 +14 -13
  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} +30 -8
  16. package/ui-cv/cv-input-digit/cv-input-digit.vue +69 -13
  17. package/ui-cv/cv-input-idcard/cv-input-idcard.vue +70 -14
  18. package/ui-cv/cv-input-number/cv-input-number.vue +56 -13
  19. package/ui-cv/cv-input-password/cv-input-password.vue +66 -12
  20. package/ui-cv/cv-input-text/cv-input-text.vue +74 -7
  21. package/ui-cv/cv-picker1/cv-picker1.vue +28 -4
  22. package/ui-cv/cv-picker2/cv-picker2.vue +34 -11
  23. package/ui-cv/cv-picker3/cv-picker3.vue +41 -16
  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 +24 -15
  28. package/ui-cv/cv-search/cv-search.vue +7 -1
  29. package/ui-cv/cv-specs/cv-specs.vue +13 -13
  30. package/ui-cv/cv-switch/cv-switch.vue +24 -16
  31. package/ui-cv/cv-textarea/cv-textarea.vue +18 -12
  32. package/ui-cv/cv-time-base/cv-time-base.vue +30 -3
  33. package/ui-cv/cv-treaty/cv-treaty.vue +18 -13
  34. package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +12 -5
  35. package/ui-cv/cv-upload-image/cv-upload-image.vue +21 -10
  36. package/ui-cv/cv-input-btn/cv-input-btn.vue +0 -124
  37. package/ui-cv/mixins/mixins-input.js +0 -75
  38. package/ui-cv/mixins/mixins-picker.js +0 -34
@@ -17,9 +17,7 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
- import MixinsPicker from '../mixins/mixins-picker.js';
21
20
  export default {
22
- mixins: [MixinsPicker],
23
21
  name: 'cvPickerTime',
24
22
  props: {
25
23
  //默认输入框
@@ -27,6 +25,10 @@ export default {
27
25
  type: String,
28
26
  default: ''
29
27
  },
28
+ modelValue: {
29
+ type: String,
30
+ default: ''
31
+ },
30
32
  startTime: {
31
33
  type: String,
32
34
  default: ''
@@ -34,6 +36,19 @@ export default {
34
36
  endTime: {
35
37
  type: String,
36
38
  default: ''
39
+ },
40
+ // 占位符
41
+ placeholder: {
42
+ type: String,
43
+ default: '请选择'
44
+ }
45
+ },
46
+ watch: {
47
+ value(newVal) {
48
+ this.localVal = newVal;
49
+ },
50
+ modelValue(newVal) {
51
+ this.localVal = newVal;
37
52
  }
38
53
  },
39
54
  data() {
@@ -43,13 +58,25 @@ export default {
43
58
  };
44
59
  },
45
60
  created() {
46
- this.localVal = this.value;
61
+ this.localVal = this.doValueGet();
47
62
  },
48
63
  methods: {
64
+ doValueGet() {
65
+ if (this.value === '') return this.modelValue;
66
+ if (this.modelValue === '') return this.value;
67
+ return this.value;
68
+ },
49
69
  bindTimeChange: function (e) {
50
70
  this.localVal = e.detail.value;
71
+ this.iconTop = false;
51
72
  this.$emit('input', this.localVal);
73
+ this.$emit('update:modelValue', this.localVal);
74
+ },
75
+ bindPickerCancel() {
52
76
  this.iconTop = false;
77
+ },
78
+ changeIconTop() {
79
+ this.iconTop = true;
53
80
  }
54
81
  }
55
82
  };
@@ -3,7 +3,7 @@
3
3
  <view class="cv-treaty-item">
4
4
  <label class="cv-treaty-label">
5
5
  <checkbox-group class="cv-treaty-item-group" @change="hindChange">
6
- <checkbox value="true" :checked="vModel" :disabled="disabled" style="transform: scale(0.7)" />
6
+ <checkbox value="true" :checked="localVal" :disabled="disabled" style="transform: scale(0.7)" />
7
7
  {{ explain }}
8
8
  </checkbox-group>
9
9
  </label>
@@ -18,6 +18,18 @@
18
18
  export default {
19
19
  name: 'cvTreaty',
20
20
  props: {
21
+ value: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ modelValue: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
21
33
  explain: {
22
34
  type: String,
23
35
  default: '我已阅读'
@@ -29,28 +41,21 @@ export default {
29
41
  url: {
30
42
  type: String,
31
43
  default: ''
32
- },
33
- value: {
34
- type: Boolean,
35
- default: false
36
- },
37
- disabled: {
38
- type: Boolean,
39
- default: false
40
44
  }
41
45
  },
42
46
  data() {
43
47
  return {
44
- vModel: false
48
+ localVal: false
45
49
  };
46
50
  },
47
51
  created() {
48
- this.vModel = this.value;
52
+ this.localVal = this.value;
49
53
  },
50
54
  methods: {
51
55
  hindChange(e) {
52
- this.vModel = e.detail.value[0] ? true : false;
53
- this.$emit('input', this.vModel);
56
+ this.localVal = e.detail.value[0] ? true : false;
57
+ this.$emit('input', this.localVal);
58
+ this.$emit('update:modelValue', this.localVal);
54
59
  },
55
60
  handleClick() {
56
61
  if (this.url) {
@@ -10,6 +10,14 @@
10
10
  export default {
11
11
  name: 'cvUploadAvatar',
12
12
  props: {
13
+ value: {
14
+ type: [Number, String],
15
+ default: ''
16
+ },
17
+ modelValue: {
18
+ type: [Number, String],
19
+ default: ''
20
+ },
13
21
  label: {
14
22
  type: String,
15
23
  default: '当前头像'
@@ -19,11 +27,6 @@ export default {
19
27
  type: String,
20
28
  default: '请输入'
21
29
  },
22
- //默认输入框
23
- value: {
24
- type: [Number, String],
25
- default: ''
26
- },
27
30
  maxlength: {
28
31
  type: [Number, String],
29
32
  default: -1
@@ -55,6 +58,9 @@ export default {
55
58
  value(newVal) {
56
59
  this.localVal = newVal;
57
60
  },
61
+ modelValue(newVal) {
62
+ this.localVal = newVal;
63
+ },
58
64
  src(newVal) {
59
65
  this.localSrc = newVal;
60
66
  }
@@ -96,6 +102,7 @@ export default {
96
102
  this.localVal = resData.save_url;
97
103
  this.localSrc = resData.img_cdn;
98
104
  this.$emit('input', this.localVal);
105
+ this.$emit('update:modelValue', this.localVal);
99
106
  }
100
107
  });
101
108
  }
@@ -80,6 +80,18 @@ export default {
80
80
  name: 'cvUploadImg',
81
81
  components: {},
82
82
  props: {
83
+ value: {
84
+ type: [Array, Object, String],
85
+ default() {
86
+ return [];
87
+ }
88
+ },
89
+ modelValue: {
90
+ type: [Array, Object, String],
91
+ default() {
92
+ return [];
93
+ }
94
+ },
83
95
  uploadTitle: {
84
96
  type: [String],
85
97
  default: ''
@@ -100,12 +112,6 @@ export default {
100
112
  }
101
113
  },
102
114
  //默认输入框
103
- value: {
104
- type: [Array, Object, String],
105
- default() {
106
- return [];
107
- }
108
- },
109
115
  src: {
110
116
  type: [Array, Object, String],
111
117
  default(newVal) {
@@ -130,7 +136,7 @@ export default {
130
136
  return {};
131
137
  }
132
138
  },
133
- upApiFunc: {
139
+ apiFunc: {
134
140
  type: Function,
135
141
  default: null
136
142
  },
@@ -165,6 +171,9 @@ export default {
165
171
  value(newVal) {
166
172
  this.localVal = newVal;
167
173
  },
174
+ modelValue(newVal) {
175
+ this.localVal = newVal;
176
+ },
168
177
  src(newVal) {
169
178
  this.localSrc = this._dealSrc(newVal);
170
179
  this._dealNum();
@@ -288,7 +297,7 @@ export default {
288
297
  );
289
298
 
290
299
  //将本地资源上传到开发者服务器,客户端发起一个 POST 请求,其中 content-type 为 multipart/form-data。
291
- this.upApiFunc({
300
+ this.apiFunc({
292
301
  //要上传文件资源的路径。
293
302
  filePath: tempFilePaths,
294
303
  //文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
@@ -309,8 +318,9 @@ export default {
309
318
  this.localSrc.push(resData.img_cdn);
310
319
  this.localVal = resData.img_time;
311
320
  }
312
- this.$emit('input', this.localVal);
313
321
  // this.$forceUpdate();
322
+ this.$emit('input', this.localVal);
323
+ this.$emit('update:modelValue', this.localVal);
314
324
  })
315
325
  .catch((err) => {
316
326
  uni.hideLoading();
@@ -336,7 +346,7 @@ export default {
336
346
  });
337
347
  },
338
348
  imgChoose() {
339
- if (!this.upApiFunc) {
349
+ if (!this.apiFunc) {
340
350
  this._currShowToast('上传方法错误');
341
351
  return;
342
352
  }
@@ -350,6 +360,7 @@ export default {
350
360
  return new Promise((resolve, reject) => {
351
361
  this._chooseImage();
352
362
  // this.$emit('input', this.localVal);
363
+ // this.$emit('update:modelValue', this.localVal);
353
364
  });
354
365
  }
355
366
  }
@@ -1,124 +0,0 @@
1
- <template>
2
- <view class="cv-code-area">
3
- <view class="cv-code-input-area" v-bind:style="inputAreaStyle">
4
- <input
5
- class="cv-code-input-item"
6
- placeholder-class="cv-code-input-item-placeholder"
7
- v-model="localVal"
8
- :maxlength="maxlength"
9
- :placeholder="placeholder"
10
- @input="funcOnInput"
11
- @blur="onBlur"
12
- />
13
- </view>
14
- <view class="cv-code-button-area" v-bind:style="buttonAreaStyle">
15
- <button
16
- size="mini"
17
- class="cv-code-button-item"
18
- :class="btnDisabled ? 'cv-code-button-wait' : ''"
19
- :disabled="btnDisabled"
20
- @tap="click"
21
- >
22
- {{ btnText }}
23
- </button>
24
- </view>
25
- </view>
26
- </template>
27
- <script>
28
- export default {
29
- name: 'cvInputBtn',
30
- inject: {
31
- cvFormGroup: {
32
- default() {
33
- return null;
34
- }
35
- }
36
- },
37
- props: {
38
- placeholder: {
39
- type: String,
40
- default: ''
41
- },
42
- maxlength: {
43
- type: [Number, String],
44
- default: -1
45
- },
46
- value: {
47
- type: [Number, String],
48
- default: ''
49
- },
50
- btnText: {
51
- type: String,
52
- default: '发送'
53
- },
54
- btnWidth: {
55
- type: Number,
56
- default: 80
57
- },
58
- btnDisabled: {
59
- type: Boolean,
60
- default: false
61
- }
62
- },
63
- data() {
64
- return {
65
- localVal: '',
66
- buttonAreaStyle: '',
67
- inputAreaStyle: ''
68
- };
69
- },
70
- watch: {
71
- value(newVal) {
72
- this.localVal = newVal;
73
- }
74
- },
75
- created() {
76
- this.localVal = this.value;
77
- this._initStyle();
78
- },
79
- methods: {
80
- click(e) {
81
- if (this.btnDisabled) {
82
- return;
83
- }
84
- this.$emit('click', e);
85
- },
86
- funcOnInput(e) {
87
- this.$emit('input', this.localVal);
88
- },
89
- _initStyle() {
90
- this.buttonAreaStyle = 'width:' + this.btnWidth + 'px;';
91
- this.inputAreaStyle = 'width:calc(100% - ' + this.btnWidth + 'px - 10px);';
92
- }
93
- }
94
- };
95
- </script>
96
-
97
- <style>
98
- .cv-code-area {
99
- height: 36px;
100
- display: flex;
101
- justify-content: space-evenly;
102
- align-items: center;
103
- flex-direction: row;
104
- }
105
- .cv-code-input-area {
106
- width: calc(100% - 80px - 10px);
107
- }
108
- .cv-code-input-item {
109
- height: 35px;
110
- /* line-height: 35px; */
111
- }
112
- .cv-code-input-item-placeholder {
113
- font-size: 12px;
114
- }
115
- .cv-code-button-area {
116
- width: 80px;
117
- display: flex;
118
- }
119
- .cv-code-button-item {
120
- font-size: 12px;
121
- background-color: #007aff;
122
- color: #ffffff;
123
- }
124
- </style>
@@ -1,75 +0,0 @@
1
- let MixinsInput = {
2
- mixins: [],
3
- inject: {
4
- cvFormGroup: {
5
- default() {
6
- return null;
7
- }
8
- }
9
- },
10
- props: {
11
- value: {
12
- type: [Number, String],
13
- default: ''
14
- },
15
- placeholder: {
16
- type: [String],
17
- default: '请输入'
18
- },
19
- clearable: {
20
- type: [Boolean],
21
- default: false
22
- },
23
- maxlength: {
24
- type: [Number, String],
25
- default: -1
26
- },
27
- disabled: {
28
- type: [Boolean],
29
- default: false
30
- }
31
- },
32
- watch: {
33
- value(newVal) {
34
- this.localVal = newVal;
35
- }
36
- },
37
- data() {
38
- return {
39
- localStyle: '',
40
- localVal: ''
41
- };
42
- },
43
- created() {
44
- this.localVal = this.value;
45
- },
46
- mounted() {
47
- this._itemStyle();
48
- },
49
- methods: {
50
- _itemStyle() {
51
- /* 计算输入框右侧预留空间 */
52
- let paddingRight = 0;
53
- if (this.$slots['append']) {
54
- paddingRight += 20;
55
- }
56
- if (this.clearable) {
57
- paddingRight += 30;
58
- }
59
- this.localStyle = 'margin-right:' + paddingRight + 'px;';
60
- },
61
- onBlur(e) {
62
- this.localVal = e.detail.value;
63
- this.funcOnInput();
64
- },
65
- funcOnInput(e) {
66
- this.$emit('input', this.localVal);
67
- },
68
- /* 监听自己清除按钮点击事件 */
69
- onEmpty() {
70
- this.localVal = '';
71
- this.funcOnInput();
72
- }
73
- }
74
- };
75
- export default MixinsInput;
@@ -1,34 +0,0 @@
1
- let MixinsPicker = {
2
- inject: {
3
- cvFormGroup: {
4
- default() {
5
- return null;
6
- }
7
- }
8
- },
9
- props: {
10
- // 占位符
11
- placeholder: {
12
- type: String,
13
- default: '请选择'
14
- }
15
- },
16
- watch: {
17
- value(newVal) {
18
- this.localVal = newVal;
19
- }
20
- },
21
- data() {
22
- return {};
23
- },
24
- created() {},
25
- methods: {
26
- bindPickerCancel() {
27
- this.iconTop = false;
28
- },
29
- changeIconTop() {
30
- this.iconTop = true;
31
- }
32
- }
33
- };
34
- export default MixinsPicker;