@ecolovo/uniapp-components 2.0.2 → 2.0.4

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 (91) hide show
  1. package/components/aspect/aspect.vue +4 -2
  2. package/components/badge/badge.scss +3 -1
  3. package/components/badge/badge.vue +15 -11
  4. package/components/button/button.vue +69 -22
  5. package/components/checkbox/checkbox.scss +1 -1
  6. package/components/checkbox/checkbox.vue +54 -23
  7. package/components/checkbox-group/checkbox-group.vue +11 -4
  8. package/components/checkbox-group2/checkbox-group2.vue +23 -8
  9. package/components/checkbox-group2/checkbox2.vue +11 -4
  10. package/components/data-list/data-list.vue +25 -5
  11. package/components/date-picker/date-picker-view.vue +45 -16
  12. package/components/date-picker/date-picker.vue +58 -18
  13. package/components/dialog/dialog-content.vue +39 -12
  14. package/components/dialog/dialog.vue +30 -19
  15. package/components/dropdown/dropdown.vue +29 -6
  16. package/components/empty/empty.vue +10 -3
  17. package/components/flex/flex.vue +16 -6
  18. package/components/form-item/form-item.vue +13 -4
  19. package/components/icon/icon.scss +9 -0
  20. package/components/icon/icon.vue +46 -8
  21. package/components/image/image.vue +13 -8
  22. package/components/index.d.ts +50 -0
  23. package/components/index.js +50 -0
  24. package/components/index.ts +50 -0
  25. package/components/input/input.vue +13 -3
  26. package/components/input/password-input.vue +2 -2
  27. package/components/list-page/list-page.vue +24 -6
  28. package/components/load-more/load-more.vue +7 -2
  29. package/components/loading/animations/loading-animation3.vue +10 -5
  30. package/components/loading/animations/loading-animation4.vue +65 -8
  31. package/components/loading/loading.vue +7 -6
  32. package/components/message-box/message-box.d.ts +18 -0
  33. package/components/message-box/message-box.js +1 -0
  34. package/components/message-box/message-box.ts +18 -0
  35. package/components/message-box/message-box.vue +53 -21
  36. package/components/number-dialog/number-dialog.vue +61 -21
  37. package/components/number-input/number-input.vue +53 -18
  38. package/components/numpad/numpad.vue +11 -5
  39. package/components/page/page-body.scss +1 -1
  40. package/components/page/page-body.vue +79 -11
  41. package/components/page/page-footer.vue +11 -5
  42. package/components/page/page-header.vue +49 -24
  43. package/components/page/page.scss +2 -1
  44. package/components/page/page.vue +74 -29
  45. package/components/picker/picker-popup.vue +96 -68
  46. package/components/picker/picker.vue +11 -5
  47. package/components/popover/popover-content.vue +59 -19
  48. package/components/popover/popover-mask.vue +18 -11
  49. package/components/popover/popover.vue +13 -3
  50. package/components/popup/popup-content.vue +35 -11
  51. package/components/popup/popup.vue +36 -17
  52. package/components/price/price.scss +1 -0
  53. package/components/price/price.vue +18 -7
  54. package/components/search/search.vue +24 -10
  55. package/components/searching/searching.scss +14 -0
  56. package/components/searching/searching.vue +17 -10
  57. package/components/selector/selector.vue +10 -3
  58. package/components/switch/switch.vue +31 -10
  59. package/components/tab/tab.vue +41 -8
  60. package/components/textarea/textarea.vue +55 -13
  61. package/composable/component-name.js +2 -1
  62. package/composable/component-name.ts +2 -1
  63. package/composable/message-box.d.ts +35 -0
  64. package/composable/message-box.js +56 -0
  65. package/composable/message-box.ts +98 -0
  66. package/configs/index.d.ts +8 -1
  67. package/configs/index.js +14 -3
  68. package/configs/index.ts +8 -1
  69. package/easyCom.js +10 -5
  70. package/easyCom.ts +10 -5
  71. package/globals.d.ts +36 -0
  72. package/index.d.ts +4 -0
  73. package/index.js +4 -0
  74. package/index.ts +5 -0
  75. package/package.json +14 -6
  76. package/styles/global.scss +123 -2
  77. package/styles/reset.scss +5 -0
  78. package/styles/utils/css-var.scss +11 -11
  79. package/styles/utils/index.scss +0 -1
  80. package/styles/var/component.scss +23 -20
  81. package/styles/var/theme.scss +3 -3
  82. package/utils/date.d.ts +7 -2
  83. package/utils/date.js +31 -10
  84. package/utils/date.ts +20 -6
  85. package/utils/price.d.ts +4 -1
  86. package/utils/price.js +12 -7
  87. package/utils/price.ts +8 -3
  88. package/utils/round.js +4 -1
  89. package/utils/round.ts +4 -1
  90. package/utils/windowInfo.d.ts +0 -1
  91. package/styles/utils/z-index.scss +0 -10
@@ -4,11 +4,13 @@
4
4
  ...classNames,
5
5
  ...iconClass,
6
6
  $style['Icon'],
7
- {
8
- [$style['Icon--spinning']]: spinning,
9
- },
7
+ { [$style['Icon--expand-tap-size']]: tapSize },
8
+ { [$style['Icon--spinning']]: spinning },
10
9
  ]"
11
- ></text>
10
+ :style="inlineCssVar"
11
+ @click="$emit('click')"
12
+ >
13
+ </text>
12
14
  </template>
13
15
 
14
16
  <script lang="ts" setup>
@@ -25,17 +27,26 @@ defineOptions({
25
27
 
26
28
  const classNames = useClassNames('icon');
27
29
 
30
+ defineEmits<{
31
+ (e: 'click'): void;
32
+ }>();
33
+
28
34
  type _Props = {
29
35
  /** 图标名 */
30
36
  icon: string;
37
+ /** 点击范围 */
38
+ tapSize?: string;
31
39
  /** 旋转动画 */
32
40
  spinning?: boolean;
33
41
  };
34
42
 
35
43
  const props = withDefaults(defineProps<_Props>(), {
44
+ tapSize: '',
36
45
  spinning: false,
37
46
  });
38
47
 
48
+ const inlineCssVar = computed(() => `--tap-size: ${props.tapSize || '100%'};`);
49
+
39
50
  const iconEntry = computed(() => {
40
51
  /* eslint-disable no-console */
41
52
  if (!props.icon) console.error('icon 不能为空');
@@ -59,7 +70,7 @@ const iconEntry = computed(() => {
59
70
  "@import '@/resources/iconfont/iconfont.css';",
60
71
  '```',
61
72
  `\n当前可用的图标列表: `,
62
- [...iconMap.keys()].join('\n'),
73
+ [...iconMap.keys()].sort().join('\n'),
63
74
  ].join('\n')
64
75
  );
65
76
  console.groupEnd();
@@ -71,17 +82,44 @@ const iconEntry = computed(() => {
71
82
  });
72
83
 
73
84
  const iconClass = computed(() =>
74
- iconEntry.value ? [iconEntry.value.fontFamily, iconEntry.value.prefix + iconEntry.value.name] : []
85
+ iconEntry.value
86
+ ? [
87
+ iconEntry.value.fontFamily,
88
+ iconEntry.value.prefix + iconEntry.value.name,
89
+ ]
90
+ : []
75
91
  );
76
92
  </script>
77
93
 
78
94
  <style lang="scss">
79
95
  @import '../../resources/iconfont/uniapp_ui_icon/iconfont.css';
80
96
  </style>
97
+
81
98
  <style lang="scss" module>
99
+ @use '../../styles/utils' as *;
100
+ @use './icon' as *;
101
+
102
+ // 定义外部变量
103
+ %external-vars {
104
+ @include UTILS__DEFINE_COMPONENT_VARS('icon', $icon);
105
+ }
106
+
82
107
  .Icon {
83
- font-size: inherit;
84
- line-height: inherit;
108
+ @extend %external-vars;
109
+ display: inline-block;
110
+ font-size: UTILS__LOCAL_VAR(font-size);
111
+ }
112
+ .Icon--expand-tap-size {
113
+ position: relative;
114
+ &::after {
115
+ content: '';
116
+ position: absolute;
117
+ top: 50%;
118
+ left: 50%;
119
+ width: var(--tap-size, 100%);
120
+ height: var(--tap-size, 100%);
121
+ transform: translate(-50%, -50%);
122
+ }
85
123
  }
86
124
  .Icon--spinning {
87
125
  display: inline-block;
@@ -2,7 +2,7 @@
2
2
  <image
3
3
  :src="src || ''"
4
4
  :preview-list="previewList"
5
- :class="[...classNames, $style['Image']]"
5
+ :class="[...classNames]"
6
6
  :mode="mode"
7
7
  @click="preview"
8
8
  ></image>
@@ -25,6 +25,8 @@ type _Props = {
25
25
  src?: string;
26
26
  /** 图片显示模式 */
27
27
  mode?: string;
28
+ /** 是否开启预览 */
29
+ preview?: boolean;
28
30
  /** 预览列表 */
29
31
  previewList?: string[];
30
32
  };
@@ -32,10 +34,20 @@ type _Props = {
32
34
  const props = withDefaults(defineProps<_Props>(), {
33
35
  src: '',
34
36
  mode: '',
37
+ preview: false,
35
38
  previewList: () => [],
36
39
  });
37
40
 
41
+ const emit = defineEmits<{
42
+ (e: 'click'): void;
43
+ }>();
44
+
38
45
  const preview = () => {
46
+ if (!props.preview) {
47
+ emit('click');
48
+ return;
49
+ }
50
+
39
51
  if (props.previewList.length > 0) {
40
52
  uni.previewImage({
41
53
  current: props.src,
@@ -49,10 +61,3 @@ const preview = () => {
49
61
  });
50
62
  };
51
63
  </script>
52
-
53
- <style lang="scss" module>
54
- .Image {
55
- width: 100%;
56
- height: 100%;
57
- }
58
- </style>
@@ -0,0 +1,50 @@
1
+ export { default as Aspect } from './aspect/aspect.vue';
2
+ export { default as Badge } from './badge/badge.vue';
3
+ export { default as Button } from './button/button.vue';
4
+ export { default as Checkbox } from './checkbox/checkbox.vue';
5
+ export { default as CheckboxGroup } from './checkbox-group/checkbox-group.vue';
6
+ export { default as CheckboxGroup2 } from './checkbox-group2/checkbox-group2.vue';
7
+ export { default as Checkbox2 } from './checkbox-group2/checkbox2.vue';
8
+ export { default as DataList } from './data-list/data-list.vue';
9
+ export { default as DatePickerView } from './date-picker/date-picker-view.vue';
10
+ export { default as DatePicker } from './date-picker/date-picker.vue';
11
+ export { default as DialogContent } from './dialog/dialog-content.vue';
12
+ export { default as Dialog } from './dialog/dialog.vue';
13
+ export { default as Dropdown } from './dropdown/dropdown.vue';
14
+ export { default as Empty } from './empty/empty.vue';
15
+ export { default as Flex } from './flex/flex.vue';
16
+ export { default as Form } from './form/form.vue';
17
+ export { default as FormItem } from './form-item/form-item.vue';
18
+ export { default as Icon } from './icon/icon.vue';
19
+ export { default as Image } from './image/image.vue';
20
+ export { default as Input } from './input/input.vue';
21
+ export { default as PasswordInput } from './input/password-input.vue';
22
+ export { default as ListPage } from './list-page/list-page.vue';
23
+ export { default as LoadMore } from './load-more/load-more.vue';
24
+ export { default as LoadingAnimation1 } from './loading/animations/loading-animation1.vue';
25
+ export { default as LoadingAnimation2 } from './loading/animations/loading-animation2.vue';
26
+ export { default as LoadingAnimation3 } from './loading/animations/loading-animation3.vue';
27
+ export { default as LoadingAnimation4 } from './loading/animations/loading-animation4.vue';
28
+ export { default as Loading } from './loading/loading.vue';
29
+ export { default as MessageBox } from './message-box/message-box.vue';
30
+ export { default as NumberDialog } from './number-dialog/number-dialog.vue';
31
+ export { default as NumberInput } from './number-input/number-input.vue';
32
+ export { default as Numpad } from './numpad/numpad.vue';
33
+ export { default as PageBody } from './page/page-body.vue';
34
+ export { default as PageFooter } from './page/page-footer.vue';
35
+ export { default as PageHeader } from './page/page-header.vue';
36
+ export { default as Page } from './page/page.vue';
37
+ export { default as PickerPopup } from './picker/picker-popup.vue';
38
+ export { default as Picker } from './picker/picker.vue';
39
+ export { default as PopoverContent } from './popover/popover-content.vue';
40
+ export { default as PopoverMask } from './popover/popover-mask.vue';
41
+ export { default as Popover } from './popover/popover.vue';
42
+ export { default as PopupContent } from './popup/popup-content.vue';
43
+ export { default as Popup } from './popup/popup.vue';
44
+ export { default as Price } from './price/price.vue';
45
+ export { default as Search } from './search/search.vue';
46
+ export { default as Searching } from './searching/searching.vue';
47
+ export { default as Selector } from './selector/selector.vue';
48
+ export { default as Switch } from './switch/switch.vue';
49
+ export { default as Tab } from './tab/tab.vue';
50
+ export { default as Textarea } from './textarea/textarea.vue';
@@ -0,0 +1,50 @@
1
+ export { default as Aspect } from './aspect/aspect.vue';
2
+ export { default as Badge } from './badge/badge.vue';
3
+ export { default as Button } from './button/button.vue';
4
+ export { default as Checkbox } from './checkbox/checkbox.vue';
5
+ export { default as CheckboxGroup } from './checkbox-group/checkbox-group.vue';
6
+ export { default as CheckboxGroup2 } from './checkbox-group2/checkbox-group2.vue';
7
+ export { default as Checkbox2 } from './checkbox-group2/checkbox2.vue';
8
+ export { default as DataList } from './data-list/data-list.vue';
9
+ export { default as DatePickerView } from './date-picker/date-picker-view.vue';
10
+ export { default as DatePicker } from './date-picker/date-picker.vue';
11
+ export { default as DialogContent } from './dialog/dialog-content.vue';
12
+ export { default as Dialog } from './dialog/dialog.vue';
13
+ export { default as Dropdown } from './dropdown/dropdown.vue';
14
+ export { default as Empty } from './empty/empty.vue';
15
+ export { default as Flex } from './flex/flex.vue';
16
+ export { default as Form } from './form/form.vue';
17
+ export { default as FormItem } from './form-item/form-item.vue';
18
+ export { default as Icon } from './icon/icon.vue';
19
+ export { default as Image } from './image/image.vue';
20
+ export { default as Input } from './input/input.vue';
21
+ export { default as PasswordInput } from './input/password-input.vue';
22
+ export { default as ListPage } from './list-page/list-page.vue';
23
+ export { default as LoadMore } from './load-more/load-more.vue';
24
+ export { default as LoadingAnimation1 } from './loading/animations/loading-animation1.vue';
25
+ export { default as LoadingAnimation2 } from './loading/animations/loading-animation2.vue';
26
+ export { default as LoadingAnimation3 } from './loading/animations/loading-animation3.vue';
27
+ export { default as LoadingAnimation4 } from './loading/animations/loading-animation4.vue';
28
+ export { default as Loading } from './loading/loading.vue';
29
+ export { default as MessageBox } from './message-box/message-box.vue';
30
+ export { default as NumberDialog } from './number-dialog/number-dialog.vue';
31
+ export { default as NumberInput } from './number-input/number-input.vue';
32
+ export { default as Numpad } from './numpad/numpad.vue';
33
+ export { default as PageBody } from './page/page-body.vue';
34
+ export { default as PageFooter } from './page/page-footer.vue';
35
+ export { default as PageHeader } from './page/page-header.vue';
36
+ export { default as Page } from './page/page.vue';
37
+ export { default as PickerPopup } from './picker/picker-popup.vue';
38
+ export { default as Picker } from './picker/picker.vue';
39
+ export { default as PopoverContent } from './popover/popover-content.vue';
40
+ export { default as PopoverMask } from './popover/popover-mask.vue';
41
+ export { default as Popover } from './popover/popover.vue';
42
+ export { default as PopupContent } from './popup/popup-content.vue';
43
+ export { default as Popup } from './popup/popup.vue';
44
+ export { default as Price } from './price/price.vue';
45
+ export { default as Search } from './search/search.vue';
46
+ export { default as Searching } from './searching/searching.vue';
47
+ export { default as Selector } from './selector/selector.vue';
48
+ export { default as Switch } from './switch/switch.vue';
49
+ export { default as Tab } from './tab/tab.vue';
50
+ export { default as Textarea } from './textarea/textarea.vue';
@@ -0,0 +1,50 @@
1
+ export { default as Aspect } from './aspect/aspect.vue';
2
+ export { default as Badge } from './badge/badge.vue';
3
+ export { default as Button } from './button/button.vue';
4
+ export { default as Checkbox } from './checkbox/checkbox.vue';
5
+ export { default as CheckboxGroup } from './checkbox-group/checkbox-group.vue';
6
+ export { default as CheckboxGroup2 } from './checkbox-group2/checkbox-group2.vue';
7
+ export { default as Checkbox2 } from './checkbox-group2/checkbox2.vue';
8
+ export { default as DataList } from './data-list/data-list.vue';
9
+ export { default as DatePickerView } from './date-picker/date-picker-view.vue';
10
+ export { default as DatePicker } from './date-picker/date-picker.vue';
11
+ export { default as DialogContent } from './dialog/dialog-content.vue';
12
+ export { default as Dialog } from './dialog/dialog.vue';
13
+ export { default as Dropdown } from './dropdown/dropdown.vue';
14
+ export { default as Empty } from './empty/empty.vue';
15
+ export { default as Flex } from './flex/flex.vue';
16
+ export { default as Form } from './form/form.vue';
17
+ export { default as FormItem } from './form-item/form-item.vue';
18
+ export { default as Icon } from './icon/icon.vue';
19
+ export { default as Image } from './image/image.vue';
20
+ export { default as Input } from './input/input.vue';
21
+ export { default as PasswordInput } from './input/password-input.vue';
22
+ export { default as ListPage } from './list-page/list-page.vue';
23
+ export { default as LoadMore } from './load-more/load-more.vue';
24
+ export { default as LoadingAnimation1 } from './loading/animations/loading-animation1.vue';
25
+ export { default as LoadingAnimation2 } from './loading/animations/loading-animation2.vue';
26
+ export { default as LoadingAnimation3 } from './loading/animations/loading-animation3.vue';
27
+ export { default as LoadingAnimation4 } from './loading/animations/loading-animation4.vue';
28
+ export { default as Loading } from './loading/loading.vue';
29
+ export { default as MessageBox } from './message-box/message-box.vue';
30
+ export { default as NumberDialog } from './number-dialog/number-dialog.vue';
31
+ export { default as NumberInput } from './number-input/number-input.vue';
32
+ export { default as Numpad } from './numpad/numpad.vue';
33
+ export { default as PageBody } from './page/page-body.vue';
34
+ export { default as PageFooter } from './page/page-footer.vue';
35
+ export { default as PageHeader } from './page/page-header.vue';
36
+ export { default as Page } from './page/page.vue';
37
+ export { default as PickerPopup } from './picker/picker-popup.vue';
38
+ export { default as Picker } from './picker/picker.vue';
39
+ export { default as PopoverContent } from './popover/popover-content.vue';
40
+ export { default as PopoverMask } from './popover/popover-mask.vue';
41
+ export { default as Popover } from './popover/popover.vue';
42
+ export { default as PopupContent } from './popup/popup-content.vue';
43
+ export { default as Popup } from './popup/popup.vue';
44
+ export { default as Price } from './price/price.vue';
45
+ export { default as Search } from './search/search.vue';
46
+ export { default as Searching } from './searching/searching.vue';
47
+ export { default as Selector } from './selector/selector.vue';
48
+ export { default as Switch } from './switch/switch.vue';
49
+ export { default as Tab } from './tab/tab.vue';
50
+ export { default as Textarea } from './textarea/textarea.vue';
@@ -2,7 +2,10 @@
2
2
  <view :class="[...classNames, $style['Input']]" @click="setFocus">
3
3
  <view
4
4
  v-if="isReadonly || (useText && modelValue && !focused)"
5
- :class="[$style['Input--text'], { [$style['Input--ellipsis']]: ellipsis }]"
5
+ :class="[
6
+ $style['Input--text'],
7
+ { [$style['Input--ellipsis']]: ellipsis },
8
+ ]"
6
9
  >
7
10
  {{ modelValue }}
8
11
  </view>
@@ -50,7 +53,14 @@ type _Props = {
50
53
  /** 绑定值 */
51
54
  modelValue?: string;
52
55
  /** 键盘类型 */
53
- type?: 'text' | 'number' | 'idcard' | 'digit' | 'tel' | 'safe-password' | 'nickname';
56
+ type?:
57
+ | 'text'
58
+ | 'number'
59
+ | 'idcard'
60
+ | 'digit'
61
+ | 'tel'
62
+ | 'safe-password'
63
+ | 'nickname';
54
64
  /** 是否添加清空图标 */
55
65
  clearable?: boolean;
56
66
  /** 是否禁用 */
@@ -101,7 +111,7 @@ const setFocus = () => {
101
111
  </script>
102
112
 
103
113
  <style lang="scss" module>
104
- @use '../../styles/index' as *;
114
+ @use '../../styles/utils' as *;
105
115
 
106
116
  .Input {
107
117
  width: 100%;
@@ -61,7 +61,7 @@ const isShowPassword = ref(false);
61
61
  </script>
62
62
 
63
63
  <style lang="scss" module>
64
- @use '../../styles/index' as *;
64
+ @use '../../styles/utils' as *;
65
65
 
66
66
  .PasswordInput {
67
67
  width: 100%;
@@ -81,7 +81,7 @@ const isShowPassword = ref(false);
81
81
  font-size: 40rpx;
82
82
  color: #999;
83
83
  margin-left: 20rpx;
84
- #{UTILS__VAR_NAME(tap-size, icon)}: 80rpx;
84
+ #{UTILS__VAR_NAME(icon, tap-size)}: 80rpx;
85
85
  }
86
86
  }
87
87
  </style>
@@ -21,7 +21,10 @@
21
21
  <slot></slot>
22
22
  </data-list-cpn>
23
23
 
24
- <empty-cpn v-if="!pagingData || pagingData.data.length === 0" :class="$style['ListPage--empty']"></empty-cpn>
24
+ <empty-cpn
25
+ v-if="!pagingData || pagingData.data.length === 0"
26
+ :class="$style['ListPage--empty']"
27
+ ></empty-cpn>
25
28
 
26
29
  <template v-if="hasFooter" #footer>
27
30
  <slot name="footer"></slot>
@@ -31,7 +34,7 @@
31
34
 
32
35
  <script lang="ts" setup>
33
36
  import { ref } from 'vue';
34
- import { PagingData } from '@ecolovo/utils/uniapp/paging';
37
+ import type { PagingData } from '@ecolovo/utils';
35
38
  import useClassNames from '../../composable/component-name';
36
39
  import DataListCpn from '../data-list/data-list.vue';
37
40
  import EmptyCpn from '../empty/empty.vue';
@@ -77,8 +80,8 @@ const props = withDefaults(defineProps<_Props>(), {
77
80
  });
78
81
 
79
82
  const emit = defineEmits<{
80
- (e: 'refresh', payload?: Omit<PromiseWithResolvers<unknown>, 'promise'>): void;
81
- (e: 'reach-bottom', payload?: Omit<PromiseWithResolvers<unknown>, 'promise'>): void;
83
+ (e: 'refresh', payload?: UniApp.PromiseResolvers<unknown>): void;
84
+ (e: 'reach-bottom', payload?: UniApp.PromiseResolvers<unknown>): void;
82
85
  }>();
83
86
 
84
87
  /** 是否正在刷新中 */
@@ -91,7 +94,15 @@ const onRefresh = () => {
91
94
  if (isRefreshing.value) return;
92
95
 
93
96
  isRefreshing.value = true;
94
- const { promise, resolve, reject } = Promise.withResolvers();
97
+
98
+ // const { promise, resolve, reject } = Promise.withResolvers();
99
+ let resolve: UniApp.PromiseResolver<unknown>,
100
+ reject: UniApp.PromiseRejector<unknown>;
101
+ const promise = new Promise((res, rej) => {
102
+ resolve = res;
103
+ reject = rej;
104
+ });
105
+
95
106
  promise.finally(() => {
96
107
  isRefreshing.value = false;
97
108
  uni.stopPullDownRefresh();
@@ -105,7 +116,14 @@ const onLoadMore = () => {
105
116
  if (!props.pagingData?.hasMore) return;
106
117
 
107
118
  isLoadingMore.value = true;
108
- const { promise, resolve, reject } = Promise.withResolvers();
119
+ // const { promise, resolve, reject } = Promise.withResolvers();
120
+ let resolve: UniApp.PromiseResolver<unknown>,
121
+ reject: UniApp.PromiseRejector<unknown>;
122
+ const promise = new Promise((res, rej) => {
123
+ resolve = res;
124
+ reject = rej;
125
+ });
126
+
109
127
  promise.finally(() => {
110
128
  isLoadingMore.value = false;
111
129
  uni.stopPullDownRefresh();
@@ -7,7 +7,12 @@
7
7
  <icon-cpn icon="loading-dot-spinner"></icon-cpn>
8
8
  加载中...
9
9
  </view>
10
- <view v-else :class="$style['LoadMore--content']" @click="$emit('load-more')">上滑或点击加载更多</view>
10
+ <view
11
+ v-else
12
+ :class="$style['LoadMore--content']"
13
+ @click="$emit('load-more')"
14
+ >上滑或点击加载更多</view
15
+ >
11
16
  </view>
12
17
  </template>
13
18
 
@@ -50,7 +55,7 @@ defineEmits<{
50
55
 
51
56
  // 定义外部变量
52
57
  %external-vars {
53
- @include UTILS__DEFINE_COMPONENT_VARS($load-more, 'load-more');
58
+ @include UTILS__DEFINE_COMPONENT_VARS('load-more', $load-more);
54
59
  }
55
60
 
56
61
  .LoadMore {
@@ -43,22 +43,27 @@ const classNames = useClassNames('loading-animation3');
43
43
  width: $main-size;
44
44
  aspect-ratio: 1;
45
45
  border-radius: 50%;
46
- box-shadow: $left-x $translate-y 0 $size-s, 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-s;
46
+ box-shadow: $left-x $translate-y 0 $size-s, 0 $translate-y 0 $size-s,
47
+ $right-x $translate-y 0 $size-s;
47
48
  translate: 0 (-1 * $translate-y);
48
49
  animation: LoadingAnimation3--loading-dots 1.5s infinite linear;
49
50
 
50
51
  @keyframes LoadingAnimation3--loading-dots {
51
52
  15% {
52
- box-shadow: $left-x $translate-y 0 $size-l, 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-s;
53
+ box-shadow: $left-x $translate-y 0 $size-l,
54
+ 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-s;
53
55
  }
54
56
  30% {
55
- box-shadow: $left-x $translate-y 0 $size-s, 0 $translate-y 0 $size-l, $right-x $translate-y 0 $size-s;
57
+ box-shadow: $left-x $translate-y 0 $size-s,
58
+ 0 $translate-y 0 $size-l, $right-x $translate-y 0 $size-s;
56
59
  }
57
60
  45% {
58
- box-shadow: $left-x $translate-y 0 $size-s, 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-l;
61
+ box-shadow: $left-x $translate-y 0 $size-s,
62
+ 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-l;
59
63
  }
60
64
  60% {
61
- box-shadow: $left-x $translate-y 0 $size-s, 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-s;
65
+ box-shadow: $left-x $translate-y 0 $size-s,
66
+ 0 $translate-y 0 $size-s, $right-x $translate-y 0 $size-s;
62
67
  }
63
68
  }
64
69
 
@@ -30,29 +30,86 @@ const classNames = useClassNames('loading-animation4');
30
30
  aspect-ratio: 1;
31
31
  border-radius: 50%;
32
32
  border: 0.1em solid currentcolor;
33
- animation: spinner-1 0.8s infinite linear alternate, spinner-2 1.6s infinite linear;
33
+ animation: spinner-1 0.8s infinite linear alternate,
34
+ spinner-2 1.6s infinite linear;
34
35
 
35
36
  @keyframes spinner-1 {
36
37
  0% {
37
- clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%);
38
+ clip-path: polygon(
39
+ 50% 50%,
40
+ 0 0,
41
+ 50% 0%,
42
+ 50% 0%,
43
+ 50% 0%,
44
+ 50% 0%,
45
+ 50% 0%
46
+ );
38
47
  }
39
48
  12.5% {
40
- clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%);
49
+ clip-path: polygon(
50
+ 50% 50%,
51
+ 0 0,
52
+ 50% 0%,
53
+ 100% 0%,
54
+ 100% 0%,
55
+ 100% 0%,
56
+ 100% 0%
57
+ );
41
58
  }
42
59
  25% {
43
- clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100%);
60
+ clip-path: polygon(
61
+ 50% 50%,
62
+ 0 0,
63
+ 50% 0%,
64
+ 100% 0%,
65
+ 100% 100%,
66
+ 100% 100%,
67
+ 100% 100%
68
+ );
44
69
  }
45
70
  50% {
46
- clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%);
71
+ clip-path: polygon(
72
+ 50% 50%,
73
+ 0 0,
74
+ 50% 0%,
75
+ 100% 0%,
76
+ 100% 100%,
77
+ 50% 100%,
78
+ 0% 100%
79
+ );
47
80
  }
48
81
  62.5% {
49
- clip-path: polygon(50% 50%, 100% 0, 100% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%);
82
+ clip-path: polygon(
83
+ 50% 50%,
84
+ 100% 0,
85
+ 100% 0%,
86
+ 100% 0%,
87
+ 100% 100%,
88
+ 50% 100%,
89
+ 0% 100%
90
+ );
50
91
  }
51
92
  75% {
52
- clip-path: polygon(50% 50%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 50% 100%, 0% 100%);
93
+ clip-path: polygon(
94
+ 50% 50%,
95
+ 100% 100%,
96
+ 100% 100%,
97
+ 100% 100%,
98
+ 100% 100%,
99
+ 50% 100%,
100
+ 0% 100%
101
+ );
53
102
  }
54
103
  100% {
55
- clip-path: polygon(50% 50%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100%);
104
+ clip-path: polygon(
105
+ 50% 50%,
106
+ 50% 100%,
107
+ 50% 100%,
108
+ 50% 100%,
109
+ 50% 100%,
110
+ 50% 100%,
111
+ 0% 100%
112
+ );
56
113
  }
57
114
  }
58
115
  @keyframes spinner-2 {
@@ -1,7 +1,10 @@
1
1
  <template>
2
- <view :class="[...classNames, $style['Loading']]" @touchmove.stop.prevent="doNothing">
2
+ <view :class="[...classNames, $style['Loading']]" @touchmove.stop.prevent>
3
3
  <!-- #ifdef APP-PLUS -->
4
- <cover-view :class="$style['Loading--wrapper-cover']" @touchmove.stop.prevent="doNothing"></cover-view>
4
+ <cover-view
5
+ :class="$style['Loading--wrapper-cover']"
6
+ @touchmove.stop.prevent
7
+ ></cover-view>
5
8
  <!-- #endif -->
6
9
  <view :class="$style['Loading--content']">
7
10
  <loading-animation3 :class="$style['Loading--icon']" />
@@ -33,12 +36,10 @@ type _Props = {
33
36
  withDefaults(defineProps<_Props>(), {
34
37
  title: '加载中...',
35
38
  });
36
-
37
- const doNothing = () => {};
38
39
  </script>
39
40
 
40
41
  <style lang="scss" module>
41
- @use '../../styles/index' as *;
42
+ @use '../../styles/utils' as *;
42
43
 
43
44
  .Loading {
44
45
  position: fixed;
@@ -49,7 +50,7 @@ const doNothing = () => {};
49
50
  display: flex;
50
51
  justify-content: center;
51
52
  align-items: center;
52
- z-index: UTILS__z-index('loading');
53
+ z-index: UTILS__GLOBAL_VAR(z-index, loading);
53
54
  background: #0000004d;
54
55
 
55
56
  /* #ifdef APP-PLUS */
@@ -0,0 +1,18 @@
1
+ export type MessageBoxOptions = {
2
+ /** 是否可见 */
3
+ modelValue?: boolean;
4
+ /** 内容 */
5
+ content?: string;
6
+ /** 是否模态框 */
7
+ modal?: boolean;
8
+ /** 是否居中标题 */
9
+ centerTitle?: boolean;
10
+ /** 对话框标题 */
11
+ title?: string;
12
+ /** 是否显示关闭按钮 */
13
+ showClose?: boolean;
14
+ /** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
15
+ cancel?: string | boolean;
16
+ /** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
17
+ confirm?: string | boolean;
18
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ export type MessageBoxOptions = {
2
+ /** 是否可见 */
3
+ modelValue?: boolean;
4
+ /** 内容 */
5
+ content?: string;
6
+ /** 是否模态框 */
7
+ modal?: boolean;
8
+ /** 是否居中标题 */
9
+ centerTitle?: boolean;
10
+ /** 对话框标题 */
11
+ title?: string;
12
+ /** 是否显示关闭按钮 */
13
+ showClose?: boolean;
14
+ /** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
15
+ cancel?: string | boolean;
16
+ /** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
17
+ confirm?: string | boolean;
18
+ };