diff --git a/src/uni_modules/uview-plus/components/u-album/props.js b/src/uni_modules/uview-plus/components/u-album/props.js index ba4a3f1e0..1786422d0 100644 --- a/src/uni_modules/uview-plus/components/u-album/props.js +++ b/src/uni_modules/uview-plus/components/u-album/props.js @@ -67,9 +67,15 @@ export const props = defineMixin({ type: [String, Number], default: () => defProps.image.radius }, + // 自适应换行 autoWrap: { type: Boolean, default: () => defProps.album.autoWrap }, + // 单位 + unit: { + type: [String], + default: () => defProps.album.unit + } } }) diff --git a/src/uni_modules/uview-plus/components/u-album/u-album.vue b/src/uni_modules/uview-plus/components/u-album/u-album.vue index f28ea55e7..6851d392c 100644 --- a/src/uni_modules/uview-plus/components/u-album/u-album.vue +++ b/src/uni_modules/uview-plus/components/u-album/u-album.vue @@ -86,6 +86,8 @@ const dom = uni.requireNativePlugin('dom') * @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true ) * @property {String} shape 图片形状,circle-圆形,square-方形 (默认 'square' ) * @property {String | Number} radius 圆角值,单位任意,如果为数值,则为px单位 (默认 0 ) + * @property {Boolean} autoWrap 自适应换行模式,不受rowCount限制,图片会自动换行 (默认 false ) + * @property {String} unit 图片单位 (默认 px ) * @event {Function} albumWidth 某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 (回调参数 width ) * @example */ @@ -161,12 +163,12 @@ export default { }, imageWidth() { return addUnit( - this.urls.length === 1 ? this.singleWidth : this.multipleSize, 'px' + this.urls.length === 1 ? this.singleWidth : this.multipleSize, this.unit ) }, imageHeight() { return addUnit( - this.urls.length === 1 ? this.singleHeight : this.multipleSize, 'px' + this.urls.length === 1 ? this.singleHeight : this.multipleSize, this.unit ) }, // 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度 diff --git a/src/uni_modules/uview-plus/libs/config/props/album.js b/src/uni_modules/uview-plus/libs/config/props/album.js index c43cac7dc..5310d258b 100644 --- a/src/uni_modules/uview-plus/libs/config/props/album.js +++ b/src/uni_modules/uview-plus/libs/config/props/album.js @@ -21,6 +21,7 @@ export default { previewFullImage: true, rowCount: 3, showMore: true, - autoWrap: false + autoWrap: false, + unit: 'px' } }