uview-plus 3.8.125 → 3.8.126

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,3 +1,14 @@
1
+ ## 3.8.126
2
+ feat: 新增 u-flex 通用弹性布局容器组件
3
+
4
+ 新增 u-flex(up-flex)通用 flexbox 容器组件,跨端同名同默认,作为页面 view 之上的一层弹性布局落点,免去每处手写 display:flex 与各类对齐样式,让行列布局在 H5、小程序、App 各端保持一致表现。
5
+
6
+ - 支持 direction 主轴方向 row / column / row-reverse / column-reverse(默认 row)
7
+ - 支持 justify 主轴对齐 flex-start / flex-end / center / space-between / space-around / space-evenly,并兼容 start / end 简写
8
+ - 支持 align 交叉轴对齐 flex-start / flex-end / center / stretch / baseline(默认 stretch)
9
+ - 支持 wrap 是否换行(默认 false)与 gap 子元素间距(任意单位,自动 addUnit 处理)
10
+ - 支持 customStyle 外部样式深合并,暴露 click 点击事件
11
+
1
12
  ## 3.8.125
2
13
  fix: 修复签名组件在 App 端无法绘制、笔迹画出后闪退的问题
3
14
 
@@ -0,0 +1,10 @@
1
+ export default {
2
+ // flex
3
+ flex: {
4
+ direction: 'row',
5
+ justify: 'flex-start',
6
+ align: 'stretch',
7
+ wrap: false,
8
+ gap: 0
9
+ }
10
+ }
@@ -0,0 +1,34 @@
1
+ import { defineMixin } from '../../libs/vue'
2
+ import FlexDefaultProps from './flex'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(FlexDefaultProps)
6
+ export const props = defineMixin({
7
+ props: {
8
+ // 主轴方向 row/column/row-reverse/column-reverse
9
+ direction: {
10
+ type: String,
11
+ default: () => defProps.flex.direction
12
+ },
13
+ // 主轴对齐 flex-start/flex-end/center/space-between/space-around/space-evenly(兼容 start/end)
14
+ justify: {
15
+ type: String,
16
+ default: () => defProps.flex.justify
17
+ },
18
+ // 交叉轴对齐 flex-start/flex-end/center/stretch/baseline
19
+ align: {
20
+ type: String,
21
+ default: () => defProps.flex.align
22
+ },
23
+ // 是否换行
24
+ wrap: {
25
+ type: Boolean,
26
+ default: () => defProps.flex.wrap
27
+ },
28
+ // 子元素间距,单位任意
29
+ gap: {
30
+ type: [String, Number],
31
+ default: () => defProps.flex.gap
32
+ }
33
+ }
34
+ })
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <view
3
+ class="u-flex"
4
+ :style="[flexStyle]"
5
+ @tap="clickHandler"
6
+ >
7
+ <slot />
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ import { props } from './props';
13
+ import { mpMixin } from '../../libs/mixin/mpMixin';
14
+ import { mixin } from '../../libs/mixin/mixin';
15
+ import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
16
+ /**
17
+ * Flex 通用弹性布局容器
18
+ * @description 通用 flexbox 容器,跨端同名同默认,作为页面 view 的原生落点
19
+ * @property {String} direction 主轴方向 row/column/row-reverse/column-reverse (默认 'row')
20
+ * @property {String} justify 主轴对齐 (默认 'flex-start')
21
+ * @property {String} align 交叉轴对齐 (默认 'stretch')
22
+ * @property {Boolean} wrap 是否换行 (默认 false)
23
+ * @property {String | Number} gap 子元素间距,单位任意 (默认 0)
24
+ * @property {Object} customStyle 定义需要用到的外部样式
25
+ * @event {Function} click 组件被点击
26
+ * @example <up-flex direction="column" gap="16">...</up-flex>
27
+ */
28
+ export default {
29
+ name: "u-flex",
30
+ mixins: [mpMixin, mixin, props],
31
+ emits: ["click"],
32
+ computed: {
33
+ uJustify() {
34
+ if (this.justify === 'start' || this.justify === 'end') return 'flex-' + this.justify
35
+ return this.justify
36
+ },
37
+ flexStyle() {
38
+ const style = {
39
+ display: 'flex',
40
+ flexDirection: this.direction,
41
+ justifyContent: this.uJustify,
42
+ alignItems: this.align,
43
+ flexWrap: this.wrap ? 'wrap' : 'nowrap'
44
+ }
45
+ if (this.gap && Number(this.gap) !== 0) {
46
+ style.gap = addUnit(this.gap)
47
+ }
48
+ return deepMerge(style, addStyle(this.customStyle))
49
+ }
50
+ },
51
+ methods: {
52
+ clickHandler() {
53
+ this.$emit('click')
54
+ }
55
+ }
56
+ }
57
+ </script>
58
+
59
+ <style lang="scss" scoped>
60
+ .u-flex {
61
+ display: flex;
62
+ }
63
+ </style>
@@ -42,6 +42,7 @@ const componentKeys = [
42
42
  'dropdown',
43
43
  'dropdownItem',
44
44
  'empty',
45
+ 'flex',
45
46
  'form',
46
47
  'formItem',
47
48
  'gap',
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.8.125",
5
+ "version": "3.8.126",
6
6
  "description": "零云®uview-plus已兼容vue3支持多语言,120+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名、Markdown等。",
7
7
  "keywords": [
8
8
  "uview",