uview-plus 3.1.45 → 3.1.48

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 (137) hide show
  1. package/changelog.md +10 -0
  2. package/components/u-action-sheet/props.js +10 -11
  3. package/components/u-album/props.js +11 -12
  4. package/components/u-alert/props.js +8 -9
  5. package/components/u-avatar/props.js +14 -15
  6. package/components/u-avatar-group/props.js +9 -10
  7. package/components/u-back-top/props.js +10 -11
  8. package/components/u-badge/props.js +14 -15
  9. package/components/u-button/props.js +28 -29
  10. package/components/u-calendar/month.vue +1 -1
  11. package/components/u-calendar/props.js +27 -28
  12. package/components/u-car-keyboard/props.js +0 -1
  13. package/components/u-cell/props.js +17 -18
  14. package/components/u-cell/u-cell.vue +11 -2
  15. package/components/u-cell-group/props.js +2 -3
  16. package/components/u-checkbox/props.js +13 -14
  17. package/components/u-checkbox-group/props.js +16 -17
  18. package/components/u-circle-progress/props.js +1 -2
  19. package/components/u-code/props.js +6 -7
  20. package/components/u-code/u-code.vue +5 -0
  21. package/components/u-code-input/props.js +16 -17
  22. package/components/u-col/props.js +5 -6
  23. package/components/u-collapse/props.js +3 -4
  24. package/components/u-collapse-item/props.js +11 -12
  25. package/components/u-column-notice/props.js +10 -11
  26. package/components/u-count-down/props.js +4 -5
  27. package/components/u-count-down/u-count-down.vue +5 -0
  28. package/components/u-count-to/props.js +11 -12
  29. package/components/u-datetime-picker/props.js +24 -25
  30. package/components/u-divider/props.js +8 -9
  31. package/components/u-dropdown/props.js +0 -1
  32. package/components/u-dropdown-item/props.js +0 -1
  33. package/components/u-empty/props.js +11 -12
  34. package/components/u-form/props.js +8 -9
  35. package/components/u-form/u-form.vue +1 -1
  36. package/components/u-form-item/props.js +13 -9
  37. package/components/u-form-item/u-form-item.vue +1 -0
  38. package/components/u-gap/props.js +4 -5
  39. package/components/u-grid/props.js +3 -4
  40. package/components/u-grid-item/props.js +2 -3
  41. package/components/u-grid-item/u-grid-item.vue +5 -0
  42. package/components/u-icon/props.js +17 -18
  43. package/components/u-icon/u-icon.vue +9 -6
  44. package/components/u-image/props.js +16 -17
  45. package/components/u-index-anchor/props.js +5 -6
  46. package/components/u-index-item/props.js +0 -1
  47. package/components/u-index-list/props.js +5 -6
  48. package/components/u-index-list/u-index-list.vue +2 -1
  49. package/components/u-input/props.js +35 -36
  50. package/components/u-keyboard/props.js +16 -17
  51. package/components/u-line/props.js +6 -7
  52. package/components/u-line-progress/props.js +5 -6
  53. package/components/u-link/props.js +7 -8
  54. package/components/u-list/props.js +14 -15
  55. package/components/u-list-item/props.js +1 -2
  56. package/components/u-loading-icon/props.js +11 -12
  57. package/components/u-loading-page/props.js +9 -10
  58. package/components/u-loadmore/props.js +18 -19
  59. package/components/u-modal/props.js +16 -17
  60. package/components/u-navbar/props.js +16 -17
  61. package/components/u-no-network/props.js +3 -4
  62. package/components/u-notice-bar/props.js +13 -14
  63. package/components/u-notify/props.js +9 -10
  64. package/components/u-notify/u-notify.vue +5 -0
  65. package/components/u-number-box/props.js +22 -23
  66. package/components/u-number-keyboard/props.js +3 -4
  67. package/components/u-overlay/props.js +4 -5
  68. package/components/u-parse/props.js +8 -9
  69. package/components/u-parse/u-parse.vue +6 -1
  70. package/components/u-picker/props.js +16 -17
  71. package/components/u-picker-column/props.js +0 -1
  72. package/components/u-popup/props.js +15 -16
  73. package/components/u-radio/props.js +13 -14
  74. package/components/u-radio-group/props.js +17 -18
  75. package/components/u-rate/props.js +14 -15
  76. package/components/u-read-more/props.js +8 -9
  77. package/components/u-row/props.js +3 -4
  78. package/components/u-row-notice/props.js +7 -8
  79. package/components/u-row-notice/u-row-notice.vue +5 -0
  80. package/components/u-safe-bottom/props.js +0 -1
  81. package/components/u-scroll-list/props.js +6 -7
  82. package/components/u-search/props.js +24 -25
  83. package/components/u-skeleton/props.js +11 -12
  84. package/components/u-slider/props.js +11 -12
  85. package/components/u-status-bar/props.js +1 -2
  86. package/components/u-steps/props.js +7 -8
  87. package/components/u-steps-item/props.js +4 -5
  88. package/components/u-sticky/props.js +6 -7
  89. package/components/u-sticky/u-sticky.vue +5 -0
  90. package/components/u-subsection/props.js +9 -10
  91. package/components/u-swipe-action/props.js +1 -2
  92. package/components/u-swipe-action-item/nvue.js +5 -0
  93. package/components/u-swipe-action-item/props.js +6 -7
  94. package/components/u-swiper/props.js +24 -25
  95. package/components/u-swiper-indicator/props.js +5 -6
  96. package/components/u-switch/props.js +11 -12
  97. package/components/u-tabbar/props.js +8 -9
  98. package/components/u-tabbar-item/props.js +6 -7
  99. package/components/u-table/props.js +0 -1
  100. package/components/u-tabs/props.js +12 -13
  101. package/components/u-tabs-item/props.js +0 -1
  102. package/components/u-tag/props.js +15 -16
  103. package/components/u-td/props.js +0 -1
  104. package/components/u-text/props.js +21 -22
  105. package/components/u-textarea/props.js +23 -24
  106. package/components/u-toast/u-toast.vue +5 -0
  107. package/components/u-toolbar/props.js +6 -7
  108. package/components/u-tooltip/props.js +11 -12
  109. package/components/u-tr/props.js +0 -1
  110. package/components/u-transition/props.js +4 -5
  111. package/components/u-transition/transition.js +8 -9
  112. package/components/u-upload/props.js +22 -23
  113. package/libs/config/props/actionSheet.js +1 -1
  114. package/libs/config/props/album.js +1 -1
  115. package/libs/config/props/avatarGroup.js +1 -1
  116. package/libs/config/props/backtop.js +2 -2
  117. package/libs/config/props/badge.js +1 -1
  118. package/libs/config/props/calendar.js +3 -3
  119. package/libs/config/props/checkboxGroup.js +1 -1
  120. package/libs/config/props/datetimePicker.js +1 -1
  121. package/libs/config/props/form.js +3 -3
  122. package/libs/config/props/formItem.js +1 -0
  123. package/libs/config/props/indexList.js +1 -1
  124. package/libs/config/props/noticeBar.js +1 -1
  125. package/libs/config/props/picker.js +2 -2
  126. package/libs/config/props/popup.js +1 -1
  127. package/libs/config/props/search.js +2 -2
  128. package/libs/config/props/slider.js +1 -1
  129. package/libs/config/props/swiper.js +1 -1
  130. package/libs/config/props/tabs.js +7 -7
  131. package/libs/config/props/text.js +2 -2
  132. package/libs/config/props/toast.js +1 -1
  133. package/libs/config/props/tooltip.js +1 -1
  134. package/libs/config/props/upload.js +3 -3
  135. package/libs/css/components.scss +11 -1
  136. package/libs/css/flex.scss +73 -71
  137. package/package.json +1 -1
@@ -1,131 +1,130 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 是否打开组件
5
4
  show: {
6
5
  type: Boolean,
7
- default: defprops.datetimePicker.show
6
+ default: () => uni.$u.props.datetimePicker.show
8
7
  },
9
8
  // 弹出的方向,可选值为 top bottom right left center
10
9
  popupMode: {
11
10
  type: String,
12
- default: defprops.picker.popupMode
11
+ default: () => uni.$u.props.picker.popupMode
13
12
  },
14
13
  // 是否展示顶部的操作栏
15
14
  showToolbar: {
16
15
  type: Boolean,
17
- default: defprops.datetimePicker.showToolbar
16
+ default: () => uni.$u.props.datetimePicker.showToolbar
18
17
  },
19
18
  // #ifdef VUE2
20
19
  // 绑定值
21
20
  value: {
22
21
  type: [String, Number],
23
- default: defprops.datetimePicker.value
22
+ default: () => uni.$u.props.datetimePicker.value
24
23
  },
25
24
  // #endif
26
25
  // #ifdef VUE3
27
26
  // 绑定值
28
27
  modelValue: {
29
28
  type: [String, Number],
30
- default: defprops.datetimePicker.value
29
+ default: () => uni.$u.props.datetimePicker.value
31
30
  },
32
31
  // #endif
33
32
  // 顶部标题
34
33
  title: {
35
34
  type: String,
36
- default: defprops.datetimePicker.title
35
+ default: () => uni.$u.props.datetimePicker.title
37
36
  },
38
37
  // 展示格式,mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择
39
38
  mode: {
40
39
  type: String,
41
- default: defprops.datetimePicker.mode
40
+ default: () => uni.$u.props.datetimePicker.mode
42
41
  },
43
42
  // 可选的最大时间
44
43
  maxDate: {
45
44
  type: Number,
46
45
  // 最大默认值为后10年
47
- default: defprops.datetimePicker.maxDate
46
+ default: () => uni.$u.props.datetimePicker.maxDate
48
47
  },
49
48
  // 可选的最小时间
50
49
  minDate: {
51
50
  type: Number,
52
51
  // 最小默认值为前10年
53
- default: defprops.datetimePicker.minDate
52
+ default: () => uni.$u.props.datetimePicker.minDate
54
53
  },
55
54
  // 可选的最小小时,仅mode=time有效
56
55
  minHour: {
57
56
  type: Number,
58
- default: defprops.datetimePicker.minHour
57
+ default: () => uni.$u.props.datetimePicker.minHour
59
58
  },
60
59
  // 可选的最大小时,仅mode=time有效
61
60
  maxHour: {
62
61
  type: Number,
63
- default: defprops.datetimePicker.maxHour
62
+ default: () => uni.$u.props.datetimePicker.maxHour
64
63
  },
65
64
  // 可选的最小分钟,仅mode=time有效
66
65
  minMinute: {
67
66
  type: Number,
68
- default: defprops.datetimePicker.minMinute
67
+ default: () => uni.$u.props.datetimePicker.minMinute
69
68
  },
70
69
  // 可选的最大分钟,仅mode=time有效
71
70
  maxMinute: {
72
71
  type: Number,
73
- default: defprops.datetimePicker.maxMinute
72
+ default: () => uni.$u.props.datetimePicker.maxMinute
74
73
  },
75
74
  // 选项过滤函数
76
75
  filter: {
77
76
  type: [Function, null],
78
- default: defprops.datetimePicker.filter
77
+ default: () => uni.$u.props.datetimePicker.filter
79
78
  },
80
79
  // 选项格式化函数
81
80
  formatter: {
82
81
  type: [Function, null],
83
- default: defprops.datetimePicker.formatter
82
+ default: () => uni.$u.props.datetimePicker.formatter
84
83
  },
85
84
  // 是否显示加载中状态
86
85
  loading: {
87
86
  type: Boolean,
88
- default: defprops.datetimePicker.loading
87
+ default: () => uni.$u.props.datetimePicker.loading
89
88
  },
90
89
  // 各列中,单个选项的高度
91
90
  itemHeight: {
92
91
  type: [String, Number],
93
- default: defprops.datetimePicker.itemHeight
92
+ default: () => uni.$u.props.datetimePicker.itemHeight
94
93
  },
95
94
  // 取消按钮的文字
96
95
  cancelText: {
97
96
  type: String,
98
- default: defprops.datetimePicker.cancelText
97
+ default: () => uni.$u.props.datetimePicker.cancelText
99
98
  },
100
99
  // 确认按钮的文字
101
100
  confirmText: {
102
101
  type: String,
103
- default: defprops.datetimePicker.confirmText
102
+ default: () => uni.$u.props.datetimePicker.confirmText
104
103
  },
105
104
  // 取消按钮的颜色
106
105
  cancelColor: {
107
106
  type: String,
108
- default: defprops.datetimePicker.cancelColor
107
+ default: () => uni.$u.props.datetimePicker.cancelColor
109
108
  },
110
109
  // 确认按钮的颜色
111
110
  confirmColor: {
112
111
  type: String,
113
- default: defprops.datetimePicker.confirmColor
112
+ default: () => uni.$u.props.datetimePicker.confirmColor
114
113
  },
115
114
  // 每列中可见选项的数量
116
115
  visibleItemCount: {
117
116
  type: [String, Number],
118
- default: defprops.datetimePicker.visibleItemCount
117
+ default: () => uni.$u.props.datetimePicker.visibleItemCount
119
118
  },
120
119
  // 是否允许点击遮罩关闭选择器
121
120
  closeOnClickOverlay: {
122
121
  type: Boolean,
123
- default: defprops.datetimePicker.closeOnClickOverlay
122
+ default: () => uni.$u.props.datetimePicker.closeOnClickOverlay
124
123
  },
125
124
  // 各列的默认索引
126
125
  defaultIndex: {
127
126
  type: Array,
128
- default: defprops.datetimePicker.defaultIndex
127
+ default: () => uni.$u.props.datetimePicker.defaultIndex
129
128
  }
130
129
  }
131
130
  }
@@ -1,45 +1,44 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 是否虚线
5
4
  dashed: {
6
5
  type: Boolean,
7
- default: defprops.divider.dashed
6
+ default: () => uni.$u.props.divider.dashed
8
7
  },
9
8
  // 是否细线
10
9
  hairline: {
11
10
  type: Boolean,
12
- default: defprops.divider.hairline
11
+ default: () => uni.$u.props.divider.hairline
13
12
  },
14
13
  // 是否以点替代文字,优先于text字段起作用
15
14
  dot: {
16
15
  type: Boolean,
17
- default: defprops.divider.dot
16
+ default: () => uni.$u.props.divider.dot
18
17
  },
19
18
  // 内容文本的位置,left-左边,center-中间,right-右边
20
19
  textPosition: {
21
20
  type: String,
22
- default: defprops.divider.textPosition
21
+ default: () => uni.$u.props.divider.textPosition
23
22
  },
24
23
  // 文本内容
25
24
  text: {
26
25
  type: [String, Number],
27
- default: defprops.divider.text
26
+ default: () => uni.$u.props.divider.text
28
27
  },
29
28
  // 文本大小
30
29
  textSize: {
31
30
  type: [String, Number],
32
- default: defprops.divider.textSize
31
+ default: () => uni.$u.props.divider.textSize
33
32
  },
34
33
  // 文本颜色
35
34
  textColor: {
36
35
  type: String,
37
- default: defprops.divider.textColor
36
+ default: () => uni.$u.props.divider.textColor
38
37
  },
39
38
  // 线条颜色
40
39
  lineColor: {
41
40
  type: String,
42
- default: defprops.divider.lineColor
41
+ default: () => uni.$u.props.divider.lineColor
43
42
  }
44
43
  }
45
44
  }
@@ -1,4 +1,3 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 标题选中时的样式
@@ -1,4 +1,3 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 当前选中项的value值
@@ -1,60 +1,59 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 内置图标名称,或图片路径,建议绝对路径
5
4
  icon: {
6
5
  type: String,
7
- default: defprops.empty.icon
6
+ default: () => uni.$u.props.empty.icon
8
7
  },
9
8
  // 提示文字
10
9
  text: {
11
10
  type: String,
12
- default: defprops.empty.text
11
+ default: () => uni.$u.props.empty.text
13
12
  },
14
13
  // 文字颜色
15
14
  textColor: {
16
15
  type: String,
17
- default: defprops.empty.textColor
16
+ default: () => uni.$u.props.empty.textColor
18
17
  },
19
18
  // 文字大小
20
19
  textSize: {
21
20
  type: [String, Number],
22
- default: defprops.empty.textSize
21
+ default: () => uni.$u.props.empty.textSize
23
22
  },
24
23
  // 图标的颜色
25
24
  iconColor: {
26
25
  type: String,
27
- default: defprops.empty.iconColor
26
+ default: () => uni.$u.props.empty.iconColor
28
27
  },
29
28
  // 图标的大小
30
29
  iconSize: {
31
30
  type: [String, Number],
32
- default: defprops.empty.iconSize
31
+ default: () => uni.$u.props.empty.iconSize
33
32
  },
34
33
  // 选择预置的图标类型
35
34
  mode: {
36
35
  type: String,
37
- default: defprops.empty.mode
36
+ default: () => uni.$u.props.empty.mode
38
37
  },
39
38
  // 图标宽度,单位px
40
39
  width: {
41
40
  type: [String, Number],
42
- default: defprops.empty.width
41
+ default: () => uni.$u.props.empty.width
43
42
  },
44
43
  // 图标高度,单位px
45
44
  height: {
46
45
  type: [String, Number],
47
- default: defprops.empty.height
46
+ default: () => uni.$u.props.empty.height
48
47
  },
49
48
  // 是否显示组件
50
49
  show: {
51
50
  type: Boolean,
52
- default: defprops.empty.show
51
+ default: () => uni.$u.props.empty.show
53
52
  },
54
53
  // 组件距离上一个元素之间的距离,默认px单位
55
54
  marginTop: {
56
55
  type: [String, Number],
57
- default: defprops.empty.marginTop
56
+ default: () => uni.$u.props.empty.marginTop
58
57
  }
59
58
  }
60
59
  }
@@ -1,46 +1,45 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 当前form的需要验证字段的集合
5
4
  model: {
6
5
  type: Object,
7
- default: defprops.form.model
6
+ default: () => uni.$u.props.form.model
8
7
  },
9
8
  // 验证规则
10
9
  rules: {
11
10
  type: [Object, Function, Array],
12
- default: defprops.form.rules
11
+ default: () => uni.$u.props.form.rules
13
12
  },
14
13
  // 有错误时的提示方式,message-提示信息,toast-进行toast提示
15
14
  // border-bottom-下边框呈现红色,none-无提示
16
15
  errorType: {
17
16
  type: String,
18
- default: defprops.form.errorType
17
+ default: () => uni.$u.props.form.errorType
19
18
  },
20
19
  // 是否显示表单域的下划线边框
21
20
  borderBottom: {
22
21
  type: Boolean,
23
- default: defprops.form.borderBottom
22
+ default: () => uni.$u.props.form.borderBottom
24
23
  },
25
24
  // label的位置,left-左边,top-上边
26
25
  labelPosition: {
27
26
  type: String,
28
- default: defprops.form.labelPosition
27
+ default: () => uni.$u.props.form.labelPosition
29
28
  },
30
29
  // label的宽度,单位px
31
30
  labelWidth: {
32
31
  type: [String, Number],
33
- default: defprops.form.labelWidth
32
+ default: () => uni.$u.props.form.labelWidth
34
33
  },
35
34
  // lable字体的对齐方式
36
35
  labelAlign: {
37
36
  type: String,
38
- default: defprops.form.labelAlign
37
+ default: () => uni.$u.props.form.labelAlign
39
38
  },
40
39
  // lable的样式,对象形式
41
40
  labelStyle: {
42
41
  type: Object,
43
- default: defprops.form.labelStyle
42
+ default: () => uni.$u.props.form.labelStyle
44
43
  }
45
44
  }
46
45
  }
@@ -146,7 +146,7 @@
146
146
  const propertyName =
147
147
  propertyChain[propertyChain.length - 1];
148
148
 
149
- const rule = this.formRules[child.prop];
149
+ const rule = this.formRules[child.rule || child.prop];
150
150
  // 如果不存在对应的规则,直接返回,否则校验器会报错
151
151
  if (!rule) return;
152
152
  // rule规则可为数组形式,也可为对象形式,此处拼接成为数组
@@ -1,44 +1,48 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // input的label提示语
5
4
  label: {
6
5
  type: String,
7
- default: defprops.formItem.label
6
+ default: () => uni.$u.props.formItem.label
8
7
  },
9
8
  // 绑定的值
10
9
  prop: {
11
10
  type: String,
12
- default: defprops.formItem.prop
11
+ default: () => uni.$u.props.formItem.prop
12
+ },
13
+ // 绑定的规则
14
+ prop: {
15
+ type: String,
16
+ default: () => uni.$u.props.formItem.rule
13
17
  },
14
18
  // 是否显示表单域的下划线边框
15
19
  borderBottom: {
16
20
  type: [String, Boolean],
17
- default: defprops.formItem.borderBottom
21
+ default: () => uni.$u.props.formItem.borderBottom
18
22
  },
19
23
  // label的宽度,单位px
20
24
  labelWidth: {
21
25
  type: [String, Number],
22
- default: defprops.formItem.labelWidth
26
+ default: () => uni.$u.props.formItem.labelWidth
23
27
  },
24
28
  // 右侧图标
25
29
  rightIcon: {
26
30
  type: String,
27
- default: defprops.formItem.rightIcon
31
+ default: () => uni.$u.props.formItem.rightIcon
28
32
  },
29
33
  // 左侧图标
30
34
  leftIcon: {
31
35
  type: String,
32
- default: defprops.formItem.leftIcon
36
+ default: () => uni.$u.props.formItem.leftIcon
33
37
  },
34
38
  // 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置
35
39
  required: {
36
40
  type: Boolean,
37
- default: defprops.formItem.required
41
+ default: () => uni.$u.props.formItem.required
38
42
  },
39
43
  leftIconStyle: {
40
44
  type: [String, Object],
41
- default: defprops.formItem.leftIconStyle,
45
+ default: () => uni.$u.props.formItem.leftIconStyle,
42
46
  }
43
47
  }
44
48
  }
@@ -84,6 +84,7 @@
84
84
  * @tutorial https://ijry.github.io/uview-plus/components/form.html
85
85
  * @property {String} label input的label提示语
86
86
  * @property {String} prop 绑定的值
87
+ * @property {String} rule 绑定的规则
87
88
  * @property {String | Boolean} borderBottom 是否显示表单域的下划线边框
88
89
  * @property {String | Number} labelWidth label的宽度,单位px
89
90
  * @property {String} rightIcon 右侧图标
@@ -1,25 +1,24 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 背景颜色(默认transparent)
5
4
  bgColor: {
6
5
  type: String,
7
- default: defprops.gap.bgColor
6
+ default: () => uni.$u.props.gap.bgColor
8
7
  },
9
8
  // 分割槽高度,单位px(默认30)
10
9
  height: {
11
10
  type: [String, Number],
12
- default: defprops.gap.height
11
+ default: () => uni.$u.props.gap.height
13
12
  },
14
13
  // 与上一个组件的距离
15
14
  marginTop: {
16
15
  type: [String, Number],
17
- default: defprops.gap.marginTop
16
+ default: () => uni.$u.props.gap.marginTop
18
17
  },
19
18
  // 与下一个组件的距离
20
19
  marginBottom: {
21
20
  type: [String, Number],
22
- default: defprops.gap.marginBottom
21
+ default: () => uni.$u.props.gap.marginBottom
23
22
  }
24
23
  }
25
24
  }
@@ -1,20 +1,19 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 分成几列
5
4
  col: {
6
5
  type: [String, Number],
7
- default: defprops.grid.col
6
+ default: () => uni.$u.props.grid.col
8
7
  },
9
8
  // 是否显示边框
10
9
  border: {
11
10
  type: Boolean,
12
- default: defprops.grid.border
11
+ default: () => uni.$u.props.grid.border
13
12
  },
14
13
  // 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
15
14
  align: {
16
15
  type: String,
17
- default: defprops.grid.align
16
+ default: () => uni.$u.props.grid.align
18
17
  }
19
18
  }
20
19
  }
@@ -1,15 +1,14 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 宫格的name
5
4
  name: {
6
5
  type: [String, Number, null],
7
- default: defprops.gridItem.name
6
+ default: () => uni.$u.props.gridItem.name
8
7
  },
9
8
  // 背景颜色
10
9
  bgColor: {
11
10
  type: String,
12
- default: defprops.gridItem.bgColor
11
+ default: () => uni.$u.props.gridItem.bgColor
13
12
  }
14
13
  }
15
14
  }
@@ -166,7 +166,12 @@
166
166
  }
167
167
  }
168
168
  },
169
+ // #ifdef VUE2
169
170
  beforeDestroy() {
171
+ // #endif
172
+ // #ifdef VUE3
173
+ beforeUnmount() {
174
+ // #endif
170
175
  // 移除事件监听,释放性能
171
176
  uni.$off('$uGridItem')
172
177
  }
@@ -1,90 +1,89 @@
1
- import defprops from '../../libs/config/props';
2
1
  export default {
3
2
  props: {
4
3
  // 图标类名
5
4
  name: {
6
5
  type: String,
7
- default: defprops.icon.name
6
+ default: () => uni.$u.props.icon.name
8
7
  },
9
8
  // 图标颜色,可接受主题色
10
9
  color: {
11
10
  type: String,
12
- default: defprops.icon.color
11
+ default: () => uni.$u.props.icon.color
13
12
  },
14
13
  // 字体大小,单位px
15
14
  size: {
16
15
  type: [String, Number],
17
- default: defprops.icon.size
16
+ default: () => uni.$u.props.icon.size
18
17
  },
19
18
  // 是否显示粗体
20
19
  bold: {
21
20
  type: Boolean,
22
- default: defprops.icon.bold
21
+ default: () => uni.$u.props.icon.bold
23
22
  },
24
23
  // 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
25
24
  index: {
26
25
  type: [String, Number],
27
- default: defprops.icon.index
26
+ default: () => uni.$u.props.icon.index
28
27
  },
29
28
  // 触摸图标时的类名
30
29
  hoverClass: {
31
30
  type: String,
32
- default: defprops.icon.hoverClass
31
+ default: () => uni.$u.props.icon.hoverClass
33
32
  },
34
33
  // 自定义扩展前缀,方便用户扩展自己的图标库
35
34
  customPrefix: {
36
35
  type: String,
37
- default: defprops.icon.customPrefix
36
+ default: () => uni.$u.props.icon.customPrefix
38
37
  },
39
38
  // 图标右边或者下面的文字
40
39
  label: {
41
40
  type: [String, Number],
42
- default: defprops.icon.label
41
+ default: () => uni.$u.props.icon.label
43
42
  },
44
43
  // label的位置,只能右边或者下边
45
44
  labelPos: {
46
45
  type: String,
47
- default: defprops.icon.labelPos
46
+ default: () => uni.$u.props.icon.labelPos
48
47
  },
49
48
  // label的大小
50
49
  labelSize: {
51
50
  type: [String, Number],
52
- default: defprops.icon.labelSize
51
+ default: () => uni.$u.props.icon.labelSize
53
52
  },
54
53
  // label的颜色
55
54
  labelColor: {
56
55
  type: String,
57
- default: defprops.icon.labelColor
56
+ default: () => uni.$u.props.icon.labelColor
58
57
  },
59
58
  // label与图标的距离
60
59
  space: {
61
60
  type: [String, Number],
62
- default: defprops.icon.space
61
+ default: () => uni.$u.props.icon.space
63
62
  },
64
63
  // 图片的mode
65
64
  imgMode: {
66
65
  type: String,
67
- default: defprops.icon.imgMode
66
+ default: () => uni.$u.props.icon.imgMode
68
67
  },
69
68
  // 用于显示图片小图标时,图片的宽度
70
69
  width: {
71
70
  type: [String, Number],
72
- default: defprops.icon.width
71
+ default: () => uni.$u.props.icon.width
73
72
  },
74
73
  // 用于显示图片小图标时,图片的高度
75
74
  height: {
76
75
  type: [String, Number],
77
- default: defprops.icon.height
76
+ default: () => uni.$u.props.icon.height
78
77
  },
79
78
  // 用于解决某些情况下,让图标垂直居中的用途
80
79
  top: {
81
80
  type: [String, Number],
82
- default: defprops.icon.top
81
+ default: () => uni.$u.props.icon.top
83
82
  },
84
83
  // 是否阻止事件传播
85
84
  stop: {
86
85
  type: Boolean,
87
- default: defprops.icon.stop
86
+ default: () => uni.$u.props.icon.stop
88
87
  }
89
88
  }
90
89
  }
@@ -92,12 +92,13 @@
92
92
  uClasses() {
93
93
  let classes = []
94
94
  classes.push(this.customPrefix + '-' + this.name)
95
- // // uView的自定义图标类名为u-iconfont
96
- // if (this.customPrefix == 'uicon') {
97
- // classes.push('u-iconfont')
98
- // } else {
99
- // classes.push(this.customPrefix)
100
- // }
95
+ // uView的自定义图标类名为u-iconfont
96
+ if (this.customPrefix == 'uicon') {
97
+ classes.push('u-iconfont')
98
+ } else {
99
+ // 不能缺少这一步,否则自定义图标会无效
100
+ classes.push(this.customPrefix)
101
+ }
101
102
  // 主题色,通过类配置
102
103
  if (this.color && uni.$u.config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
103
104
  // 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
@@ -134,6 +135,8 @@
134
135
  },
135
136
  // 通过图标名,查找对应的图标
136
137
  icon() {
138
+ // 使用自定义图标的时候页面上会把name属性也展示出来,所以在这里处理一下
139
+ if (this.customPrefix !== "uicon") return "";
137
140
  // 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
138
141
  return icons['uicon-' + this.name] || this.name
139
142
  }