@ecolovo/uniapp-components 1.0.9 → 1.0.10

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.
@@ -25,7 +25,7 @@
25
25
  @getphonenumber="onOpenType('getphonenumber', $event)"
26
26
  @agreeprivacyauthorization="onOpenType('agreeprivacyauthorization', $event)"
27
27
  >
28
- <!-- 仅在线性按钮且不是禁用态时显示 -->
28
+ <!-- 线性按钮边框:仅在线性按钮且不是禁用态时显示 -->
29
29
  <view v-if="!disabled && !text && plain" :class="$style['Button--plain-border']"></view>
30
30
  <!-- 仅在配置了图标或文本按钮处于加载态(不能处于禁用态)时显示 -->
31
31
  <template v-if="text">
@@ -38,15 +38,15 @@
38
38
  </template>
39
39
  <view v-else :class="$style['Button--title']">
40
40
  <icon-cpn
41
- v-if="icon || (text && isLoading && !disabled)"
41
+ v-if="icon"
42
42
  :class="$style['Button--icon']"
43
43
  :icon="text && isLoading ? 'loading-dot-spinner' : icon"
44
44
  />
45
45
  <slot></slot>
46
46
  </view>
47
- <!-- 仅在非文本按钮且不是禁用态时显示 -->
47
+ <!-- 点击态样式:仅在非文本按钮且不是禁用态时显示 -->
48
48
  <view v-if="!disabled && !text" :class="$style['Button--active-mask']"></view>
49
- <!-- 仅在非文本按钮处于加载态(不能处于禁用态)时显示 -->
49
+ <!-- 加载态样式:仅在非文本按钮处于加载态(不能处于禁用态)时显示 -->
50
50
  <view v-if="!disabled && !text && isLoading" :class="$style['Button--loading']">
51
51
  <icon-cpn icon="loading-dot-spinner" />
52
52
  </view>
@@ -59,6 +59,7 @@ export default {
59
59
  return this.value === null ? this.checkedValue : this.value;
60
60
  },
61
61
  set: function (val) {
62
+ if (this.checkedValue === val) return;
62
63
  this.$emit('input', val);
63
64
  this.checkedValue = val;
64
65
  this.$emit('change', val);
@@ -68,7 +69,10 @@ export default {
68
69
  watch: {
69
70
  value: {
70
71
  handler: function (val) {
72
+ if (this.checkedValue === val) return;
73
+ this.$emit('input', val);
71
74
  this.checkedValue = val;
75
+ this.$emit('change', val);
72
76
  },
73
77
  immediate: true,
74
78
  deep: true,
@@ -89,7 +93,7 @@ export default {
89
93
  if (this.currentValue.includes(val)) {
90
94
  this.currentValue = this.currentValue.filter((item) => item !== val);
91
95
  } else {
92
- this.currentValue.push(val);
96
+ this.currentValue = this.currentValue.concat(val);
93
97
  }
94
98
  },
95
99
  },
@@ -74,7 +74,17 @@ export default {
74
74
  components: { AspectCpn, ButtonCpn, ImageCpn, LoadingCpn },
75
75
  mixins: [componentName, UploadMixin],
76
76
  props: {
77
- /** 显示宽度 */
77
+ /** 媒体类型,可选值:'image' | 'video' | 'image,video' */
78
+ type: {
79
+ type: String,
80
+ default: 'image',
81
+ },
82
+ /** 媒体来源,可选值:'album' | 'camera' | 'album,camera' */
83
+ source: {
84
+ type: String,
85
+ default: 'album',
86
+ },
87
+ /** 列数 */
78
88
  columns: {
79
89
  type: [String, Number],
80
90
  default: 4,
@@ -100,8 +110,8 @@ export default {
100
110
  selectFile() {
101
111
  uni.chooseMedia({
102
112
  count: this.restCount,
103
- mediaType: ['image', 'video'],
104
- sourceType: ['album', 'camera'],
113
+ mediaType: this.type.split(','),
114
+ sourceType: this.source.split(','),
105
115
  success: (res) => {
106
116
  const files = this.validateFiles(res.tempFiles);
107
117
  if (this.autoUpload && files) {
@@ -11,7 +11,7 @@ export default {
11
11
  },
12
12
  /* #endif */
13
13
  computed: {
14
- /** 组件公共前缀 */
14
+ /** 组件公共前缀,大驼峰模式 */
15
15
  componentPrefix() {
16
16
  return pascalCase(componentPrefix);
17
17
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecolovo/uniapp-components",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Ecolovo UniApp 组件库",
5
5
  "scripts": {
6
6
  "lint": "eslint . --fix"