uview-pro 0.5.0 → 0.5.2

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 (52) hide show
  1. package/changelog.md +68 -24
  2. package/components/u-action-sheet/types.ts +1 -1
  3. package/components/u-alert-tips/u-alert-tips.vue +15 -15
  4. package/components/u-calendar/types.ts +3 -3
  5. package/components/u-calendar/u-calendar.vue +11 -11
  6. package/components/u-checkbox/types.ts +5 -1
  7. package/components/u-checkbox/u-checkbox.vue +41 -18
  8. package/components/u-checkbox-group/types.ts +2 -0
  9. package/components/u-checkbox-group/u-checkbox-group.vue +56 -15
  10. package/components/u-count-down/u-count-down.vue +4 -4
  11. package/components/u-empty/u-empty.vue +14 -14
  12. package/components/u-field/u-field.vue +18 -2
  13. package/components/u-form/u-form.vue +1 -1
  14. package/components/u-form-item/u-form-item.vue +12 -5
  15. package/components/u-full-screen/u-full-screen.vue +2 -2
  16. package/components/u-gap/u-gap.vue +3 -3
  17. package/components/u-input/types.ts +1 -1
  18. package/components/u-keyboard/types.ts +2 -2
  19. package/components/u-keyboard/u-keyboard.vue +3 -3
  20. package/components/u-link/types.ts +1 -1
  21. package/components/u-loadmore/types.ts +3 -3
  22. package/components/u-modal/types.ts +4 -4
  23. package/components/u-navbar/u-navbar.vue +8 -2
  24. package/components/u-no-network/types.ts +1 -1
  25. package/components/u-no-network/u-no-network.vue +5 -5
  26. package/components/u-pagination/types.ts +2 -2
  27. package/components/u-picker/types.ts +2 -2
  28. package/components/u-radio/types.ts +2 -0
  29. package/components/u-radio/u-radio.vue +16 -7
  30. package/components/u-radio-group/u-radio-group.vue +1 -1
  31. package/components/u-read-more/types.ts +2 -2
  32. package/components/u-search/types.ts +5 -3
  33. package/components/u-search/u-search.vue +1 -0
  34. package/components/u-section/types.ts +1 -1
  35. package/components/u-select/types.ts +2 -2
  36. package/components/u-tabbar/u-tabbar.vue +1 -1
  37. package/components/u-text/u-text.vue +7 -2
  38. package/components/u-toast/u-toast.vue +14 -11
  39. package/components/u-transition/types.ts +35 -0
  40. package/components/u-transition/u-transition.vue +437 -0
  41. package/components/u-upload/types.ts +1 -1
  42. package/components/u-upload/u-upload.vue +12 -12
  43. package/components/u-verification-code/types.ts +3 -3
  44. package/index.ts +2 -0
  45. package/libs/hooks/index.ts +2 -0
  46. package/libs/hooks/useDebounce.ts +15 -0
  47. package/libs/hooks/useThrottle.ts +16 -0
  48. package/locale/lang/en-US.ts +19 -19
  49. package/locale/lang/zh-CN.ts +19 -19
  50. package/package.json +9 -9
  51. package/types/components.d.ts +1 -0
  52. package/types/global.d.ts +14 -0
@@ -121,7 +121,7 @@ defineExpose({
121
121
  if (!fields.value.includes(field)) fields.value.push(field);
122
122
  },
123
123
  removeField(field: any) {
124
- fields.value = fields.value.filter(f => f.prop !== field.prop)
124
+ fields.value = fields.value.filter(f => f.prop !== field.prop);
125
125
  },
126
126
  fields,
127
127
  rules,
@@ -27,7 +27,7 @@
27
27
  }"
28
28
  >
29
29
  <!-- 为了块对齐 -->
30
- <view class="u-form-item--left__content" v-if="required || leftIcon || label">
30
+ <view class="u-form-item--left__content" v-if="required || leftIcon || label || $slots.label">
31
31
  <!-- nvue不支持伪元素before -->
32
32
  <text v-if="required" class="u-form-item--left__content--required">*</text>
33
33
  <view class="u-form-item--left__content__icon" v-if="leftIcon">
@@ -47,7 +47,9 @@
47
47
  }
48
48
  ]"
49
49
  >
50
- {{ label }}
50
+ <slot name="label">
51
+ {{ label }}
52
+ </slot>
51
53
  </view>
52
54
  </view>
53
55
  </view>
@@ -88,7 +90,7 @@ export default {
88
90
  </script>
89
91
 
90
92
  <script setup lang="ts">
91
- import { ref, computed, onMounted, onBeforeUnmount, watch, nextTick } from 'vue';
93
+ import { ref, computed, onMounted, onBeforeUnmount, watch, nextTick, useSlots } from 'vue';
92
94
  import { $u, useChildren, useParent } from '../..';
93
95
  // @ts-ignore
94
96
  import schema from '../../libs/util/async-validator';
@@ -119,6 +121,9 @@ const { broadcast } = useParent('u-form-item');
119
121
 
120
122
  const props = defineProps(FormItemProps);
121
123
 
124
+ // 插槽
125
+ const $slots = useSlots();
126
+
122
127
  const { parentExposed } = useChildren('u-form-item', 'u-form');
123
128
 
124
129
  // 组件状态
@@ -163,7 +168,7 @@ watch(
163
168
  const uLabelWidth = computed(() => {
164
169
  // 如果用户设置label为空字符串(微信小程序空字符串最终会变成字符串的'true'),意味着要将label的位置宽度设置为auto
165
170
  return elLabelPosition.value == 'left'
166
- ? props.label === 'true' || props.label === ''
171
+ ? (props.label === 'true' || props.label === '') && !$slots.label
167
172
  ? 'auto'
168
173
  : $u.addUnit(elLabelWidth.value)
169
174
  : '100%';
@@ -249,7 +254,9 @@ function getPropByPath(obj: any, path: string) {
249
254
  function getRules() {
250
255
  // 父组件的所有规则
251
256
  let rules = parentExposed?.value?.rules?.value || {};
252
- rules = rules ? rules[props.prop] || getPropByPath(rules,props.prop.replace(/(\.|^)(\d+)\./,'.defaultField.fields.')).v : [];
257
+ rules = rules
258
+ ? rules[props.prop] || getPropByPath(rules, props.prop.replace(/(\.|^)(\d+)\./, '.defaultField.fields.')).v
259
+ : [];
253
260
  // 保证返回的是一个数组形式
254
261
  return [].concat(rules || []);
255
262
  }
@@ -4,8 +4,8 @@
4
4
  :class="customClass"
5
5
  :style="$u.toStyle(customStyle)"
6
6
  :show-cancel-button="true"
7
- :confirm-text="t('fullScreen.upgrade')"
8
- :title="title || t('fullScreen.title')"
7
+ :confirm-text="t('uFullScreen.upgrade')"
8
+ :title="title || t('uFullScreen.title')"
9
9
  @cancel="cancel"
10
10
  @confirm="confirm"
11
11
  >
@@ -38,9 +38,9 @@ const props = defineProps(GapProps);
38
38
  const gapStyle = computed(() => {
39
39
  return {
40
40
  backgroundColor: props.bgColor,
41
- height: props.height + 'rpx',
42
- marginTop: props.marginTop + 'rpx',
43
- marginBottom: props.marginBottom + 'rpx'
41
+ height: $u.addUnit(props.height),
42
+ marginTop: $u.addUnit(props.marginTop),
43
+ marginBottom: $u.addUnit(props.marginBottom)
44
44
  };
45
45
  });
46
46
  </script>
@@ -30,7 +30,7 @@ export const InputProps = {
30
30
  /** placeholder显示值(默认 '请输入内容') */
31
31
  placeholder: {
32
32
  type: String,
33
- default: () => t('input.placeholder')
33
+ default: () => t('uInput.placeholder')
34
34
  },
35
35
  /** 是否禁用输入框(默认false) */
36
36
  disabled: {
@@ -35,9 +35,9 @@ export const KeyboardProps = {
35
35
  /** z-index值 */
36
36
  zIndex: { type: [Number, String] as PropType<string | number>, default: '' },
37
37
  /** 取消按钮的文字 */
38
- cancelText: { type: String, default: () => t('keyboard.cancelText') },
38
+ cancelText: { type: String, default: () => t('uKeyboard.cancelText') },
39
39
  /** 确认按钮的文字 */
40
- confirmText: { type: String, default: () => t('keyboard.confirmText') }
40
+ confirmText: { type: String, default: () => t('uKeyboard.confirmText') }
41
41
  };
42
42
 
43
43
  export type KeyboardProps = ExtractPropTypes<typeof KeyboardProps>;
@@ -20,10 +20,10 @@
20
20
  tips
21
21
  ? tips
22
22
  : mode == 'number'
23
- ? t('keyboard.number')
23
+ ? t('uKeyboard.number')
24
24
  : mode == 'card'
25
- ? t('keyboard.idCard')
26
- : t('keyboard.plate')
25
+ ? t('uKeyboard.idCard')
26
+ : t('uKeyboard.plate')
27
27
  }}
28
28
  </view>
29
29
  <view
@@ -31,7 +31,7 @@ export const LinkProps = {
31
31
  /** 小程序中复制到粘贴板的提示语 */
32
32
  mpTips: {
33
33
  type: String,
34
- default: () => t('link.mpTips')
34
+ default: () => t('uLink.mpTips')
35
35
  },
36
36
  /** 下划线颜色 */
37
37
  lineColor: {
@@ -44,9 +44,9 @@ export const LoadmoreProps = {
44
44
  loadText: {
45
45
  type: Object as PropType<LoadmoreText>,
46
46
  default: () => ({
47
- loadmore: t('loadmore.loadmore'),
48
- loading: t('loadmore.loading'),
49
- nomore: t('loadmore.nomore')
47
+ loadmore: t('uLoadmore.loadmore'),
48
+ loading: t('uLoadmore.loading'),
49
+ nomore: t('uLoadmore.nomore')
50
50
  })
51
51
  },
52
52
  /** 在“没有更多”状态下,是否显示粗点 */
@@ -23,7 +23,7 @@ export const ModalProps = {
23
23
  /** 标题 */
24
24
  title: {
25
25
  type: String,
26
- default: () => t('modal.title')
26
+ default: () => t('uModal.title')
27
27
  },
28
28
  /** 弹窗宽度 */
29
29
  width: {
@@ -33,7 +33,7 @@ export const ModalProps = {
33
33
  /** 弹窗内容 */
34
34
  content: {
35
35
  type: String,
36
- default: () => t('modal.content')
36
+ default: () => t('uModal.content')
37
37
  },
38
38
  /** 是否显示标题 */
39
39
  showTitle: {
@@ -53,12 +53,12 @@ export const ModalProps = {
53
53
  /** 确认文案 */
54
54
  confirmText: {
55
55
  type: String,
56
- default: () => t('modal.confirmText')
56
+ default: () => t('uModal.confirmText')
57
57
  },
58
58
  /** 取消文案 */
59
59
  cancelText: {
60
60
  type: String,
61
- default: () => t('modal.cancelText')
61
+ default: () => t('uModal.cancelText')
62
62
  },
63
63
  /** 确认按钮颜色 */
64
64
  confirmColor: {
@@ -95,7 +95,6 @@ import { NavbarProps } from './types';
95
95
  const props = defineProps(NavbarProps);
96
96
  // 获取系统状态栏的高度
97
97
  const systemInfo = uni.getSystemInfoSync();
98
- const windowInfo = uni.getWindowInfo();
99
98
 
100
99
  let menuButtonInfo: any = {};
101
100
  // 如果是小程序,获取右上角胶囊的尺寸信息,避免导航栏右侧内容与胶囊重叠(支付宝小程序非本API,尚未兼容)
@@ -104,7 +103,14 @@ menuButtonInfo = uni.getMenuButtonBoundingClientRect();
104
103
  // #endif
105
104
 
106
105
  // 状态栏高度
107
- const statusBarHeight = ref(windowInfo.statusBarHeight);
106
+ const statusBarHeight = ref(0);
107
+ // #ifdef APP || H5 || MP-ALIPAY || MP-WEIXIN
108
+ const windowInfo = uni.getWindowInfo();
109
+ statusBarHeight.value = windowInfo.statusBarHeight;
110
+ // #endif
111
+ // #ifndef APP || H5 || MP-ALIPAY || MP-WEIXIN
112
+ statusBarHeight.value = systemInfo.statusBarHeight;
113
+ // #endif
108
114
 
109
115
  // 转换字符数值为真正的数值
110
116
  const navbarHeight = computed(() => {
@@ -12,7 +12,7 @@ export const NoNetworkProps = {
12
12
  /** 页面文字提示 */
13
13
  tips: {
14
14
  type: String,
15
- default: () => t('noNetwork.tips')
15
+ default: () => t('uNoNetwork.tips')
16
16
  },
17
17
  /** 一个z-index值,用于设置没有网络这个组件的层次 */
18
18
  zIndex: {
@@ -8,14 +8,14 @@
8
8
  <!-- 只有APP平台,才能跳转设置页,因为需要调用plus环境 -->
9
9
  <!-- #ifdef APP-PLUS -->
10
10
  <view class="u-to-setting">
11
- {{ t('noNetwork.checkNetwork') }}
11
+ {{ t('uNoNetwork.checkNetwork') }}
12
12
  <text class="u-setting-btn" @tap="openSettings">
13
- {{ t('noNetwork.setting') }}
13
+ {{ t('uNoNetwork.setting') }}
14
14
  </text>
15
15
  </view>
16
16
  <!-- #endif -->
17
17
  <view class="u-retry" :hover-stay-time="150" @tap="retry" hover-class="u-retry-hover">
18
- {{ t('noNetwork.retry') }}
18
+ {{ t('uNoNetwork.retry') }}
19
19
  </view>
20
20
  </view>
21
21
  </view>
@@ -98,14 +98,14 @@ function retry() {
98
98
  networkType.value = res.networkType;
99
99
  if (res.networkType == 'none') {
100
100
  uni.showToast({
101
- title: t('noNetwork.noConnection'),
101
+ title: t('uNoNetwork.noConnection'),
102
102
  icon: 'none',
103
103
  position: 'top'
104
104
  });
105
105
  isConnected.value = false;
106
106
  } else {
107
107
  uni.showToast({
108
- title: t('noNetwork.connected'),
108
+ title: t('uNoNetwork.connected'),
109
109
  icon: 'none',
110
110
  position: 'top'
111
111
  });
@@ -12,9 +12,9 @@ const { t } = useLocale();
12
12
  export const PaginationProps = {
13
13
  ...baseProps,
14
14
  /** 左侧按钮文字 */
15
- prevText: { type: String, default: () => t('pagination.prevText') },
15
+ prevText: { type: String, default: () => t('uPagination.prevText') },
16
16
  /** 右侧按钮文字 */
17
- nextText: { type: String, default: () => t('pagination.nextText') },
17
+ nextText: { type: String, default: () => t('uPagination.nextText') },
18
18
  /** 总条目数 */
19
19
  total: Number,
20
20
  /** 每页数据量 */
@@ -122,12 +122,12 @@ export const PickerProps = {
122
122
  /** 取消按钮的文字 */
123
123
  cancelText: {
124
124
  type: String,
125
- default: () => t('picker.cancelText')
125
+ default: () => t('uPicker.cancelText')
126
126
  },
127
127
  /** 确认按钮的文字 */
128
128
  confirmText: {
129
129
  type: String,
130
- default: () => t('picker.confirmText')
130
+ default: () => t('uPicker.confirmText')
131
131
  }
132
132
  };
133
133
 
@@ -8,6 +8,8 @@ import { baseProps } from '../common/props';
8
8
  */
9
9
  export const RadioProps = {
10
10
  ...baseProps,
11
+ label: { type: String, default: '' },
12
+ value: { type: [String, Number] as PropType<string | number>, default: '' },
11
13
  /** radio的名称 */
12
14
  name: { type: [String, Number] as PropType<string | number>, default: '' },
13
15
  /** 形状,square为方形,circle为圆形 */
@@ -10,7 +10,9 @@
10
10
  fontSize: $u.addUnit(labelSize)
11
11
  }"
12
12
  >
13
- <slot />
13
+ <slot>
14
+ {{ label }}
15
+ </slot>
14
16
  </view>
15
17
  </view>
16
18
  </template>
@@ -55,6 +57,12 @@ const emit = defineEmits(['change']);
55
57
  // 使用组件关系 hooks 获取父组件
56
58
  const { parentExposed } = useChildren('u-radio', 'u-radio-group');
57
59
 
60
+ // radio 的value值,id
61
+ const radioValue = computed(() => {
62
+ if (props.value !== '') return props.value;
63
+ return props.name;
64
+ });
65
+
58
66
  // 父组件的默认值(兼容没有父组件的场景)
59
67
  const parentData = computed(() => {
60
68
  return (
@@ -127,7 +135,7 @@ const elShape = computed(() =>
127
135
  */
128
136
  const iconStyle = computed(() => {
129
137
  let style: Record<string, string> = {};
130
- if (elActiveColor.value && parentData.value.value == props.name && !elDisabled.value) {
138
+ if (elActiveColor.value && parentData.value.value == radioValue.value && !elDisabled.value) {
131
139
  style.borderColor = elActiveColor.value;
132
140
  style.backgroundColor = elActiveColor.value;
133
141
  }
@@ -136,14 +144,15 @@ const iconStyle = computed(() => {
136
144
  return style;
137
145
  });
138
146
 
139
- const iconColor = computed(() => (props.name == parentData.value.value ? 'var(--u-white-color)' : 'transparent'));
147
+ const iconColor = computed(() => (radioValue.value == parentData.value.value ? 'var(--u-white-color)' : 'transparent'));
140
148
 
141
149
  const iconClass = computed(() => {
142
150
  let classes: string[] = [];
143
151
  classes.push('u-radio__icon-wrap--' + elShape.value);
144
- if (props.name == parentData.value.value) classes.push('u-radio__icon-wrap--checked');
152
+ if (radioValue.value == parentData.value.value) classes.push('u-radio__icon-wrap--checked');
145
153
  if (elDisabled.value) classes.push('u-radio__icon-wrap--disabled');
146
- if (props.name == parentData.value.value && elDisabled.value) classes.push('u-radio__icon-wrap--disabled--checked');
154
+ if (radioValue.value == parentData.value.value && elDisabled.value)
155
+ classes.push('u-radio__icon-wrap--disabled--checked');
147
156
  // 支付宝小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
148
157
  return classes.join(' ');
149
158
  });
@@ -192,7 +201,7 @@ function toggle() {
192
201
  */
193
202
  function emitEvent() {
194
203
  // u-radio的name不等于父组件的v-model的值时(意味着未选中),才发出事件,避免多次点击触发事件
195
- if (parentData.value.value != props.name) emit('change', props.name);
204
+ if (parentData.value.value != radioValue.value) emit('change', radioValue.value);
196
205
  }
197
206
  /**
198
207
  * 改变组件选中状态
@@ -201,7 +210,7 @@ function emitEvent() {
201
210
  */
202
211
  function setRadioCheckedStatus() {
203
212
  emitEvent();
204
- parentExposed?.value?.setValue(props.name);
213
+ parentExposed?.value?.setValue(radioValue.value);
205
214
  }
206
215
  </script>
207
216
 
@@ -63,7 +63,7 @@ function getData() {
63
63
 
64
64
  /**
65
65
  * 设置选中值
66
- * @param val 选中的 radio 的 name
66
+ * @param val 选中的 radio 的 value 值
67
67
  */
68
68
  function setValue(val: string | number) {
69
69
  // 通过emit事件,设置父组件通过v-model双向绑定的值
@@ -15,9 +15,9 @@ export const ReadMoreProps = {
15
15
  /** 展开后是否显示"收起"按钮 */
16
16
  toggle: { type: Boolean, default: false },
17
17
  /** 关闭时的提示文字 */
18
- closeText: { type: String, default: () => t('readMore.closeText') },
18
+ closeText: { type: String, default: () => t('uReadMore.closeText') },
19
19
  /** 展开时的提示文字 */
20
- openText: { type: String, default: () => t('readMore.openText') },
20
+ openText: { type: String, default: () => t('uReadMore.openText') },
21
21
  /** 提示的文字颜色 */
22
22
  color: { type: String, default: () => getColor('primary') },
23
23
  /** 提示文字的大小 */
@@ -16,7 +16,7 @@ export const SearchProps = {
16
16
  /** 搜索框背景色,默认值var(--u-bg-gray-light) */
17
17
  bgColor: { type: String, default: 'var(--u-bg-gray-light)' },
18
18
  /** 占位提示文字 */
19
- placeholder: { type: String, default: () => t('search.placeholder') },
19
+ placeholder: { type: String, default: () => t('uSearch.placeholder') },
20
20
  /** 是否启用清除控件 */
21
21
  clearabled: { type: Boolean, default: true },
22
22
  /** 是否自动聚焦 */
@@ -26,7 +26,7 @@ export const SearchProps = {
26
26
  /** 右边控件的样式 */
27
27
  actionStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
28
28
  /** 取消按钮文字 */
29
- actionText: { type: String, default: () => t('search.actionText') },
29
+ actionText: { type: String, default: () => t('uSearch.actionText') },
30
30
  /** 输入框内容对齐方式,可选值为 left|center|right */
31
31
  inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
32
32
  /** 是否启用输入框 */
@@ -52,7 +52,9 @@ export const SearchProps = {
52
52
  /** 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30rpx"、"30rpx 20rpx"等写法 */
53
53
  margin: { type: String, default: '0' },
54
54
  /** 左边输入框的图标,可以为uView图标名称或图片路径 */
55
- searchIcon: { type: String, default: 'search' }
55
+ searchIcon: { type: String, default: 'search' },
56
+ /** 弹出键盘时是否自动调节高度,uni-app默认值是true */
57
+ adjustPosition: { type: Boolean, default: true }
56
58
  };
57
59
 
58
60
  export type SearchProps = ExtractPropTypes<typeof SearchProps>;
@@ -34,6 +34,7 @@
34
34
  placeholder-class="u-placeholder-class"
35
35
  :placeholder="placeholder"
36
36
  :placeholder-style="`color: ${placeholderColor}`"
37
+ :adjust-position="adjustPosition"
37
38
  class="u-input"
38
39
  type="text"
39
40
  :style="[
@@ -15,7 +15,7 @@ export const SectionProps = {
15
15
  /** 标题信息 */
16
16
  title: { type: String, default: '' },
17
17
  /** 右边副标题内容 */
18
- subTitle: { type: String, default: () => t('section.subTitle') },
18
+ subTitle: { type: String, default: () => t('uSection.subTitle') },
19
19
  /** 是否显示右边的内容 */
20
20
  right: { type: Boolean, default: true },
21
21
  /** 主标题的字体大小 */
@@ -42,9 +42,9 @@ export const SelectProps = {
42
42
  /** 顶部标题 */
43
43
  title: { type: String, default: '' },
44
44
  /** 取消按钮的文字 */
45
- cancelText: { type: String, default: () => t('select.cancelText') },
45
+ cancelText: { type: String, default: () => t('uSelect.cancelText') },
46
46
  /** 确认按钮的文字 */
47
- confirmText: { type: String, default: () => t('select.confirmText') }
47
+ confirmText: { type: String, default: () => t('uSelect.confirmText') }
48
48
  };
49
49
 
50
50
  export type SelectProps = ExtractPropTypes<typeof SelectProps>;
@@ -330,7 +330,7 @@ function containerStyle(index: number) {
330
330
  const iconSizeRaw = getIconSize(index);
331
331
  const numericSize = parseFloat(String(iconSizeRaw)) || parseFloat(String(props.midButtonSize as any)) || 100;
332
332
  // paddingTop: 半个图标高度 + 10rpx 的缓冲间距
333
- style.paddingTop = $u.addUnit(numericSize / 2 + 10);
333
+ style.paddingTop = $u.addUnit(numericSize / 2 + 8);
334
334
  style.boxSizing = 'border-box';
335
335
  }
336
336
  return $u.toStyle(style);
@@ -28,9 +28,9 @@
28
28
  <u-link v-else-if="props.mode === 'link'" :href="props.href" underLine>
29
29
  <slot>{{ displayValue }}</slot>
30
30
  </u-link>
31
- <template v-else-if="props.openType && isMp">
31
+ <template v-else-if="props.openType">
32
32
  <button
33
- class="u-reset-button u-text__value"
33
+ class="u-reset-button u-text__value u-text__button"
34
34
  :class="props.type && `u-text__value--${props.type}`"
35
35
  :style="textValueStyle"
36
36
  :openType="props.openType"
@@ -296,6 +296,11 @@ function onOpenSetting(event) {
296
296
  display: flex;
297
297
  }
298
298
 
299
+ &--block &__button {
300
+ display: block;
301
+ width: 100%;
302
+ }
303
+
299
304
  &__price {
300
305
  font-size: 14px;
301
306
  color: $u-content-color;
@@ -51,17 +51,20 @@ const isShow = ref(false);
51
51
  // 定时器
52
52
  let timer: ReturnType<typeof setTimeout> | null = null;
53
53
  // 内置配置
54
- const config = ref({
55
- params: {}, // URL跳转的参数,对象
56
- title: '', // 显示文本
57
- type: '', // 主题类型,primary,success,error,warning,black
58
- duration: 2000, // 显示的时间,毫秒
59
- isTab: false, // 是否跳转tab页面
60
- url: '', // toast消失后是否跳转页面,有则跳转,优先级高于back参数
61
- icon: true, // 显示的图标
62
- position: 'center', // toast出现的位置
63
- callback: null as null | (() => void), // 执行完后的回调函数
64
- back: false // 结束toast是否自动返回上一页
54
+ const config = computed(() => {
55
+ return {
56
+ zIndex: props.zIndex, // z-index值
57
+ type: props.type, // 主题类型,primary,success,error,warning,black
58
+ duration: props.duration, // 显示的时间,毫秒
59
+ icon: props.icon, // 显示的图标
60
+ position: props.position, // toast出现的位置
61
+ callback: props.callback, // 执行完后的回调函数
62
+ back: props.back, // 结束toast是否自动返回上一页
63
+ isTab: props.isTab, // 是否跳转tab页面
64
+ url: props.url, // toast消失后是否跳转页面,有则跳转,优先级高于back参数
65
+ params: props.params, // URL跳转的参数,对象
66
+ title: '' // 显示文本
67
+ };
65
68
  });
66
69
  // 合并后的临时配置变量
67
70
  const tmpConfig = ref<any>({ ...config.value });
@@ -0,0 +1,35 @@
1
+ import type { PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
3
+ import type { TransitionDuration, TransitionPreset } from '../../types/global';
4
+
5
+ export const TransitionProps = {
6
+ ...baseProps,
7
+ show: {
8
+ type: Boolean,
9
+ default: true
10
+ },
11
+ name: {
12
+ type: String as PropType<TransitionPreset>,
13
+ default: 'fade'
14
+ },
15
+ mode: {
16
+ type: String as PropType<'out-in' | 'in-out' | ''>,
17
+ default: ''
18
+ },
19
+ duration: {
20
+ type: [Number, Object] as PropType<number | TransitionDuration>,
21
+ default: 300
22
+ },
23
+ timingFunction: {
24
+ type: String,
25
+ default: 'cubic-bezier(0.2, 0.8, 0.2, 1)'
26
+ },
27
+ delay: {
28
+ type: Number,
29
+ default: 0
30
+ },
31
+ appear: {
32
+ type: Boolean,
33
+ default: false
34
+ }
35
+ };