uview-plus 3.3.4 → 3.3.6

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/changelog.md CHANGED
@@ -1,4 +1,14 @@
1
- ## 3.3.3(2024-07-07
1
+ ## 3.3.6(2024-07-23
2
+ feat: u-album组件添加radius,shape参数,定义参考当前u-image参数
3
+
4
+ fix: 修复了calendar组件title和日期title未垂直居中的问题
5
+
6
+ fix: update:modelValue缺失emit定义
7
+
8
+ ## 3.3.5(2024-07-10)
9
+ picker组件支持hasInput模式
10
+
11
+ ## 3.3.4(2024-07-07)
2
12
  fix: input组件双向绑定问题 #419
3
13
 
4
14
  lazy-load完善emit
@@ -56,6 +56,16 @@ export const props = defineMixin({
56
56
  showMore: {
57
57
  type: Boolean,
58
58
  default: () => defProps.album.showMore
59
+ },
60
+ // 图片形状,circle-圆形,square-方形
61
+ shape: {
62
+ type: String,
63
+ default: () => defProps.image.shape
64
+ },
65
+ // 圆角,单位任意
66
+ radius: {
67
+ type: [String, Number],
68
+ default: () => defProps.image.radius
59
69
  }
60
70
  }
61
71
  })
@@ -26,7 +26,8 @@
26
26
  :style="[
27
27
  {
28
28
  width: imageWidth,
29
- height: imageHeight
29
+ height: imageHeight,
30
+ borderRadius: shape == 'circle' ? '10000px' : addUnit(radius)
30
31
  }
31
32
  ]"
32
33
  ></image>
@@ -38,6 +39,9 @@
38
39
  index1 === showUrls[showUrls.length - 1].length - 1
39
40
  "
40
41
  class="u-album__row__wrapper__text"
42
+ :style="{
43
+ borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
44
+ }"
41
45
  >
42
46
  <up-text
43
47
  :text="`+${urls.length - maxCount}`"
@@ -79,7 +83,8 @@ const dom = uni.requireNativePlugin('dom')
79
83
  * @property {Boolean} previewFullImage 是否可以预览图片 (默认 true )
80
84
  * @property {String | Number} rowCount 每行展示图片数量,如设置,singleSize和multipleSize将会无效 (默认 3 )
81
85
  * @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true )
82
- *
86
+ * @property {String} shape 图片形状,circle-圆形,square-方形 (默认 'square' )
87
+ * @property {String | Number} radius 圆角值,单位任意,如果为数值,则为px单位 (默认 0 )
83
88
  * @event {Function} albumWidth 某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 (回调参数 width )
84
89
  * @example <u-album :urls="urls2" @albumWidth="width => albumWidth = width" multipleSize="68" ></u-album>
85
90
  */
@@ -173,6 +178,7 @@ export default {
173
178
  }
174
179
  },
175
180
  methods: {
181
+ addUnit,
176
182
  // 预览图片
177
183
  onPreviewTap(url) {
178
184
  const urls = this.urls.map((item) => {
@@ -261,4 +267,4 @@ export default {
261
267
  }
262
268
  }
263
269
  }
264
- </style>
270
+ </style>
@@ -65,6 +65,8 @@
65
65
  @import "../../libs/css/components.scss";
66
66
 
67
67
  .u-calendar-header {
68
+ display: flex;
69
+ flex-direction: column;
68
70
  padding-bottom: 4px;
69
71
 
70
72
  &__title {
@@ -468,6 +468,7 @@
468
468
  .u-calendar-month {
469
469
 
470
470
  &__title {
471
+ display: flex;
471
472
  font-size: 14px;
472
473
  line-height: 42px;
473
474
  height: 42px;
@@ -2,6 +2,18 @@ import { defineMixin } from '../../libs/vue'
2
2
  import defProps from '../../libs/config/props.js'
3
3
  export const props = defineMixin({
4
4
  props: {
5
+ modelValue: {
6
+ type: Array,
7
+ default: () => []
8
+ },
9
+ hasInput: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ placeholder: {
14
+ type: String,
15
+ default: () => '请选择'
16
+ },
5
17
  // 是否展示picker弹窗
6
18
  show: {
7
19
  type: Boolean,
@@ -1,57 +1,66 @@
1
1
  <template>
2
- <u-popup
3
- :show="show"
4
- :mode="popupMode"
5
- @close="closeHandler"
6
- >
7
- <view class="u-picker">
8
- <u-toolbar
9
- v-if="showToolbar"
10
- :cancelColor="cancelColor"
11
- :confirmColor="confirmColor"
12
- :cancelText="cancelText"
13
- :confirmText="confirmText"
14
- :title="title"
15
- @cancel="cancel"
16
- @confirm="confirm"
17
- ></u-toolbar>
18
- <picker-view
19
- class="u-picker__view"
20
- :indicatorStyle="`height: ${addUnit(itemHeight)}`"
21
- :value="innerIndex"
22
- :immediateChange="immediateChange"
23
- :style="{
24
- height: `${addUnit(visibleItemCount * itemHeight)}`
25
- }"
26
- @change="changeHandler"
27
- >
28
- <picker-view-column
29
- v-for="(item, index) in innerColumns"
30
- :key="index"
31
- class="u-picker__view__column"
2
+ <view class="u-picker-warrper">
3
+ <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="showByClickInput = !showByClickInput">
4
+ <slot>
5
+ <view>
6
+ {{ inputLabel && inputLabel.length ? inputLabel.join('/') : placeholder }}
7
+ </view>
8
+ </slot>
9
+ </view>
10
+ <u-popup
11
+ :show="show || (hasInput && showByClickInput)"
12
+ :mode="popupMode"
13
+ @close="closeHandler"
14
+ >
15
+ <view class="u-picker">
16
+ <u-toolbar
17
+ v-if="showToolbar"
18
+ :cancelColor="cancelColor"
19
+ :confirmColor="confirmColor"
20
+ :cancelText="cancelText"
21
+ :confirmText="confirmText"
22
+ :title="title"
23
+ @cancel="cancel"
24
+ @confirm="confirm"
25
+ ></u-toolbar>
26
+ <picker-view
27
+ class="u-picker__view"
28
+ :indicatorStyle="`height: ${addUnit(itemHeight)}`"
29
+ :value="innerIndex"
30
+ :immediateChange="immediateChange"
31
+ :style="{
32
+ height: `${addUnit(visibleItemCount * itemHeight)}`
33
+ }"
34
+ @change="changeHandler"
32
35
  >
33
- <view
34
- v-if="testArray(item)"
35
- class="u-picker__view__column__item u-line-1"
36
- v-for="(item1, index1) in item"
37
- :key="index1"
38
- :style="{
39
- height: addUnit(itemHeight),
40
- lineHeight: addUnit(itemHeight),
41
- fontWeight: index1 === innerIndex[index] ? 'bold' : 'normal',
42
- display: 'block'
43
- }"
44
- >{{ getItemText(item1) }}</view>
45
- </picker-view-column>
46
- </picker-view>
47
- <view
48
- v-if="loading"
49
- class="u-picker--loading"
50
- >
51
- <u-loading-icon mode="circle"></u-loading-icon>
36
+ <picker-view-column
37
+ v-for="(item, index) in innerColumns"
38
+ :key="index"
39
+ class="u-picker__view__column"
40
+ >
41
+ <view
42
+ v-if="testArray(item)"
43
+ class="u-picker__view__column__item u-line-1"
44
+ v-for="(item1, index1) in item"
45
+ :key="index1"
46
+ :style="{
47
+ height: addUnit(itemHeight),
48
+ lineHeight: addUnit(itemHeight),
49
+ fontWeight: index1 === innerIndex[index] ? 'bold' : 'normal',
50
+ display: 'block'
51
+ }"
52
+ >{{ getItemText(item1) }}</view>
53
+ </picker-view-column>
54
+ </picker-view>
55
+ <view
56
+ v-if="loading"
57
+ class="u-picker--loading"
58
+ >
59
+ <u-loading-icon mode="circle"></u-loading-icon>
60
+ </view>
52
61
  </view>
53
- </view>
54
- </u-popup>
62
+ </u-popup>
63
+ </view>
55
64
  </template>
56
65
 
57
66
  <script>
@@ -96,6 +105,7 @@ export default {
96
105
  innerColumns: [],
97
106
  // 上一次的变化列索引
98
107
  columnIndex: 0,
108
+ showByClickInput: false,
99
109
  }
100
110
  },
101
111
  watch: {
@@ -115,7 +125,25 @@ export default {
115
125
  }
116
126
  },
117
127
  },
118
- emits: ['close', 'cancel', 'confirm', 'change'],
128
+ emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue'],
129
+ computed: {
130
+ inputLabel() {
131
+ let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
132
+ let res = []
133
+ items.forEach(element => {
134
+ res.push(element[this.keyName])
135
+ });
136
+ return res
137
+ },
138
+ inputValue() {
139
+ let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
140
+ let res = []
141
+ items.forEach(element => {
142
+ res.push(element['id'])
143
+ });
144
+ return res
145
+ }
146
+ },
119
147
  methods: {
120
148
  addUnit,
121
149
  testArray: test.array,
@@ -130,15 +158,25 @@ export default {
130
158
  // 关闭选择器
131
159
  closeHandler() {
132
160
  if (this.closeOnClickOverlay) {
161
+ if (this.hasInput) {
162
+ this.showByClickInput = false
163
+ }
133
164
  this.$emit('close')
134
165
  }
135
166
  },
136
167
  // 点击工具栏的取消按钮
137
168
  cancel() {
169
+ if (this.hasInput) {
170
+ this.showByClickInput = false
171
+ }
138
172
  this.$emit('cancel')
139
173
  },
140
174
  // 点击工具栏的确定按钮
141
175
  confirm() {
176
+ this.$emit('update:modelValue', this.inputValue)
177
+ if (this.hasInput) {
178
+ this.showByClickInput = false
179
+ }
142
180
  this.$emit('confirm', {
143
181
  indexs: this.innerIndex,
144
182
  value: this.innerColumns.map((item, index) => item[this.innerIndex[index]]),
@@ -169,6 +207,8 @@ export default {
169
207
  this.setLastIndex(value)
170
208
  this.setIndexs(value)
171
209
 
210
+ this.$emit('update:modelValue', this.inputValue)
211
+
172
212
  this.$emit('change', {
173
213
  // #ifndef MP-WEIXIN || MP-LARK
174
214
  // 微信小程序不能传递this,会因为循环引用而报错
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "uview-plus3.0重磅发布,全面的Vue3移动组件库。",
5
- "version": "3.3.4",
5
+ "version": "3.3.6",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",
@@ -59,6 +59,16 @@ declare interface AlbumProps {
59
59
  * @param width 宽度
60
60
  */
61
61
  onAlbumWidth?: (width: any) => any
62
+ /**
63
+ * 图片形状
64
+ * @default "square"
65
+ */
66
+ shape?: 'circle' | 'square'
67
+ /**
68
+ * 圆角,默认单位px
69
+ * @default 0
70
+ */
71
+ radius?: string | number
62
72
  }
63
73
 
64
74
  declare interface _Album {