@ecolovo/uniapp-components 2.0.7 → 2.0.9
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/components/badge/badge.vue +2 -2
- package/components/badge/types.d.ts +0 -2
- package/components/badge/types.js +1 -4
- package/components/badge/types.ts +0 -6
- package/components/button/button.vue +2 -2
- package/components/button/types.d.ts +0 -2
- package/components/button/types.js +1 -4
- package/components/button/types.ts +0 -6
- package/components/checkbox/checkbox.vue +2 -2
- package/components/checkbox/types.d.ts +0 -2
- package/components/checkbox/types.js +1 -4
- package/components/checkbox/types.ts +0 -8
- package/components/checkbox-group/checkbox-group.vue +2 -2
- package/components/checkbox-group/types.d.ts +0 -2
- package/components/checkbox-group/types.js +1 -8
- package/components/checkbox-group/types.ts +0 -12
- package/components/checkbox-group2/checkbox-group2.vue +2 -2
- package/components/date-picker/date-picker.vue +2 -2
- package/components/date-picker/types.d.ts +0 -2
- package/components/date-picker/types.js +1 -4
- package/components/date-picker/types.ts +0 -8
- package/components/dialog/dialog.vue +2 -2
- package/components/dialog/types.d.ts +0 -2
- package/components/dialog/types.js +1 -4
- package/components/dialog/types.ts +0 -6
- package/components/dropdown/dropdown.vue +2 -2
- package/components/dropdown/types.d.ts +0 -2
- package/components/dropdown/types.js +1 -4
- package/components/dropdown/types.ts +0 -8
- package/components/empty/empty.vue +2 -2
- package/components/empty/types.d.ts +0 -2
- package/components/empty/types.js +1 -9
- package/components/empty/types.ts +0 -11
- package/components/flex/flex.vue +2 -2
- package/components/flex/types.d.ts +0 -2
- package/components/flex/types.js +1 -4
- package/components/flex/types.ts +0 -6
- package/components/form/form.vue +2 -2
- package/components/form/types.d.ts +0 -2
- package/components/form/types.js +1 -4
- package/components/form/types.ts +0 -6
- package/components/form-item/form-item.vue +2 -2
- package/components/form-item/types.d.ts +0 -2
- package/components/form-item/types.js +1 -4
- package/components/form-item/types.ts +0 -8
- package/components/icon/icon.vue +59 -1
- package/components/image/image.vue +3 -2
- package/components/image/types.d.ts +0 -2
- package/components/image/types.js +1 -4
- package/components/image/types.ts +0 -6
- package/components/input/input.vue +2 -2
- package/components/input/password-input.vue +2 -2
- package/components/input/types.d.ts +0 -4
- package/components/input/types.js +1 -8
- package/components/input/types.ts +0 -14
- package/components/list-page/list-page.vue +2 -2
- package/components/list-page/types.d.ts +0 -2
- package/components/list-page/types.js +1 -4
- package/components/list-page/types.ts +0 -8
- package/components/load-more/load-more.vue +2 -2
- package/components/load-more/types.d.ts +0 -2
- package/components/load-more/types.js +1 -4
- package/components/load-more/types.ts +0 -8
- package/components/loading/loading.vue +2 -2
- package/components/loading/types.d.ts +0 -2
- package/components/loading/types.js +1 -4
- package/components/loading/types.ts +0 -8
- package/components/message-box/message-box.vue +2 -2
- package/components/message-box/types.d.ts +0 -2
- package/components/message-box/types.js +1 -4
- package/components/message-box/types.ts +0 -8
- package/components/number-dialog/number-dialog.vue +2 -2
- package/components/number-dialog/types.d.ts +0 -2
- package/components/number-dialog/types.js +1 -4
- package/components/number-dialog/types.ts +0 -8
- package/components/number-input/number-input.vue +2 -2
- package/components/number-input/types.d.ts +0 -2
- package/components/number-input/types.js +1 -4
- package/components/number-input/types.ts +0 -8
- package/components/numpad/numpad.vue +2 -2
- package/components/numpad/types.d.ts +0 -2
- package/components/numpad/types.js +1 -4
- package/components/numpad/types.ts +0 -6
- package/components/page/page-header.vue +7 -7
- package/components/page/page.vue +2 -2
- package/components/page/types.d.ts +0 -4
- package/components/page/types.js +1 -8
- package/components/page/types.ts +0 -14
- package/components/picker/picker.vue +2 -2
- package/components/picker/types.d.ts +0 -2
- package/components/picker/types.js +1 -4
- package/components/picker/types.ts +0 -6
- package/components/popover/popover.vue +2 -2
- package/components/popover/types.d.ts +0 -2
- package/components/popover/types.js +1 -4
- package/components/popover/types.ts +0 -8
- package/components/popup/popup.vue +2 -2
- package/components/popup/types.d.ts +0 -2
- package/components/popup/types.js +1 -4
- package/components/popup/types.ts +0 -6
- package/components/price/price.vue +2 -2
- package/components/price/types.d.ts +0 -2
- package/components/price/types.js +1 -4
- package/components/price/types.ts +0 -6
- package/components/search/search.vue +2 -2
- package/components/search/types.d.ts +0 -2
- package/components/search/types.js +1 -4
- package/components/search/types.ts +0 -6
- package/components/searching/searching.vue +2 -2
- package/components/searching/types.d.ts +0 -2
- package/components/searching/types.js +1 -4
- package/components/searching/types.ts +0 -8
- package/components/switch/switch.vue +2 -2
- package/components/switch/types.d.ts +0 -2
- package/components/switch/types.js +1 -4
- package/components/switch/types.ts +0 -6
- package/components/tab/tab.vue +2 -2
- package/components/tab/types.d.ts +0 -2
- package/components/tab/types.js +1 -4
- package/components/tab/types.ts +0 -6
- package/components/textarea/textarea.vue +2 -2
- package/components/textarea/types.d.ts +0 -2
- package/components/textarea/types.js +1 -4
- package/components/textarea/types.ts +0 -8
- package/components/upload/media-upload.vue +4 -3
- package/components/upload/types.d.ts +0 -2
- package/components/upload/types.js +1 -4
- package/components/upload/types.ts +0 -8
- package/composable/component-name.js +2 -2
- package/composable/component-name.ts +2 -2
- package/composable/message-box.d.ts +2 -2
- package/composable/message-box.js +6 -6
- package/composable/message-box.ts +14 -8
- package/composable/page.js +2 -2
- package/composable/page.ts +2 -2
- package/configs/index.d.ts +9 -45
- package/configs/index.js +9 -70
- package/configs/index.ts +9 -103
- package/globals.d.ts +8 -0
- package/globals.ts +7 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/index.ts +0 -1
- package/package.json +1 -1
- package/styles/global.scss +3 -0
- package/vite.d.ts +22 -0
- package/vite.js +68 -0
- package/vite.ts +107 -0
- package/init.d.ts +0 -21
- package/init.js +0 -91
- package/init.ts +0 -119
|
@@ -32,8 +32,8 @@ import { ref, computed } from 'vue';
|
|
|
32
32
|
import useClassNames from '../../composable/component-name';
|
|
33
33
|
import PopoverMaskCpn from '../popover/popover-mask.vue';
|
|
34
34
|
import PopupContentCpn from './popup-content.vue';
|
|
35
|
-
import { popupProps } from './types';
|
|
36
35
|
import { useAwaitableDialog, useModelValue } from '../../composable';
|
|
36
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
37
37
|
|
|
38
38
|
defineOptions({
|
|
39
39
|
options: {
|
|
@@ -95,7 +95,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
95
95
|
confirm: '确认',
|
|
96
96
|
closeOnConfirm: true,
|
|
97
97
|
async: false,
|
|
98
|
-
...
|
|
98
|
+
...EC_DEFAULT_PROPS.popup,
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
const emit = defineEmits<{
|
|
@@ -16,9 +16,3 @@ export type ConfigurablePopupProps = {
|
|
|
16
16
|
/** 点击确认按钮时是否自动关闭对话框 */
|
|
17
17
|
closeOnConfirm?: boolean;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
export let popupProps: ConfigurablePopupProps = {};
|
|
21
|
-
|
|
22
|
-
export const setDefaultPopupProps = (props: ConfigurablePopupProps = {}) => {
|
|
23
|
-
popupProps = props;
|
|
24
|
-
};
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
<script lang="ts" setup>
|
|
32
32
|
import { computed } from 'vue';
|
|
33
33
|
import useClassNames from '../../composable/component-name';
|
|
34
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
34
35
|
import { formatPrice } from '../../utils/price';
|
|
35
|
-
import { priceProps } from './types';
|
|
36
36
|
|
|
37
37
|
defineOptions({
|
|
38
38
|
options: {
|
|
@@ -59,7 +59,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
59
59
|
prefixUnit: false,
|
|
60
60
|
showSymbol: false,
|
|
61
61
|
alwaysShowDecimal: true,
|
|
62
|
-
...
|
|
62
|
+
...EC_DEFAULT_PROPS.price,
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
/** 格式化后的价格 */
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
import { computed, ref } from 'vue';
|
|
52
52
|
import { debounce as debounceFn } from 'lodash-es';
|
|
53
53
|
import useClassNames from '../../composable/component-name';
|
|
54
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
54
55
|
import ButtonCpn from '../button/button.vue';
|
|
55
56
|
import IconCpn from '../icon/icon.vue';
|
|
56
|
-
import { searchProps } from './types';
|
|
57
57
|
|
|
58
58
|
defineOptions({
|
|
59
59
|
options: {
|
|
@@ -92,7 +92,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
92
92
|
disabled: false,
|
|
93
93
|
readonly: false,
|
|
94
94
|
cancelButton: false,
|
|
95
|
-
...
|
|
95
|
+
...EC_DEFAULT_PROPS.search,
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
const emit = defineEmits<{
|
|
@@ -10,9 +10,3 @@ export type ConfigurableSearchProps = {
|
|
|
10
10
|
/** 是否显示取消按钮 */
|
|
11
11
|
cancelButton?: boolean;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
export let searchProps: ConfigurableSearchProps = {};
|
|
15
|
-
|
|
16
|
-
export const setDefaultSearchProps = (props: ConfigurableSearchProps = {}) => {
|
|
17
|
-
searchProps = props;
|
|
18
|
-
};
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
<script lang="ts" setup>
|
|
14
14
|
import useClassNames from '../../composable/component-name';
|
|
15
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
15
16
|
import IconCpn from '../icon/icon.vue';
|
|
16
|
-
import { searchingProps } from './types';
|
|
17
17
|
|
|
18
18
|
defineOptions({
|
|
19
19
|
options: {
|
|
@@ -34,7 +34,7 @@ type _Props = {
|
|
|
34
34
|
withDefaults(defineProps<_Props>(), {
|
|
35
35
|
image: '',
|
|
36
36
|
text: '数据加载中',
|
|
37
|
-
...
|
|
37
|
+
...EC_DEFAULT_PROPS.searching,
|
|
38
38
|
});
|
|
39
39
|
</script>
|
|
40
40
|
|
|
@@ -4,11 +4,3 @@ export type ConfigurableSearchingProps = {
|
|
|
4
4
|
/** 文本 */
|
|
5
5
|
text?: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export let searchingProps: ConfigurableSearchingProps = {};
|
|
9
|
-
|
|
10
|
-
export const setDefaultSearchingProps = (
|
|
11
|
-
props: ConfigurableSearchingProps = {}
|
|
12
|
-
) => {
|
|
13
|
-
searchingProps = props;
|
|
14
|
-
};
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
<script lang="ts" setup>
|
|
25
25
|
import { computed, inject, ref } from 'vue';
|
|
26
26
|
import useClassNames from '../../composable/component-name';
|
|
27
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
27
28
|
import IconCpn from '../icon/icon.vue';
|
|
28
|
-
import { switchProps } from './types';
|
|
29
29
|
|
|
30
30
|
defineOptions({
|
|
31
31
|
options: {
|
|
@@ -58,7 +58,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
58
58
|
valueOff: false,
|
|
59
59
|
disabled: false,
|
|
60
60
|
readonly: false,
|
|
61
|
-
...
|
|
61
|
+
...EC_DEFAULT_PROPS.switch,
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
const emit = defineEmits<{
|
|
@@ -4,9 +4,3 @@ export type ConfigurableSwitchProps = {
|
|
|
4
4
|
/** 关闭状态的值 */
|
|
5
5
|
valueOff?: boolean | number | string;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export let switchProps: ConfigurableSwitchProps = {};
|
|
9
|
-
|
|
10
|
-
export const setDefaultSwitchProps = (props: ConfigurableSwitchProps = {}) => {
|
|
11
|
-
switchProps = props;
|
|
12
|
-
};
|
package/components/tab/tab.vue
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
watch,
|
|
48
48
|
} from 'vue';
|
|
49
49
|
import useClassNames from '../../composable/component-name';
|
|
50
|
-
import {
|
|
50
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
51
51
|
|
|
52
52
|
defineOptions({
|
|
53
53
|
options: {
|
|
@@ -85,7 +85,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
85
85
|
tabs: () => [],
|
|
86
86
|
evenly: true,
|
|
87
87
|
indicator: true,
|
|
88
|
-
...
|
|
88
|
+
...EC_DEFAULT_PROPS.tab,
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
const emit = defineEmits<{
|
package/components/tab/types.js
CHANGED
package/components/tab/types.ts
CHANGED
|
@@ -73,8 +73,8 @@ import {
|
|
|
73
73
|
watch,
|
|
74
74
|
} from 'vue';
|
|
75
75
|
import useClassNames from '../../composable/component-name';
|
|
76
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
76
77
|
import IconCpn from '../icon/icon.vue';
|
|
77
|
-
import { textareaProps } from './types';
|
|
78
78
|
|
|
79
79
|
defineOptions({
|
|
80
80
|
options: {
|
|
@@ -114,7 +114,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
114
114
|
autoHeight: true,
|
|
115
115
|
readonly: false,
|
|
116
116
|
fold: true,
|
|
117
|
-
...
|
|
117
|
+
...EC_DEFAULT_PROPS.textarea,
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
const emit = defineEmits<{
|
|
@@ -8,11 +8,3 @@ export type ConfigurableTextareaProps = {
|
|
|
8
8
|
/** 当只读时,如果文字过多,是否折叠 */
|
|
9
9
|
fold?: boolean;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
export let textareaProps: ConfigurableTextareaProps = {};
|
|
13
|
-
|
|
14
|
-
export const setDefaultTextareaProps = (
|
|
15
|
-
props: ConfigurableTextareaProps = {}
|
|
16
|
-
) => {
|
|
17
|
-
textareaProps = props;
|
|
18
|
-
};
|
|
@@ -83,8 +83,9 @@ import AspectCpn from '../aspect/aspect.vue';
|
|
|
83
83
|
import IconCpn from '../icon/icon.vue';
|
|
84
84
|
import ImageCpn from '../image/image.vue';
|
|
85
85
|
import LoadingCpn from '../loading/animations/loading-animation4.vue';
|
|
86
|
-
import { useUpload } from './composable
|
|
87
|
-
import { type CommonProps
|
|
86
|
+
import { useUpload } from './composable';
|
|
87
|
+
import { type CommonProps } from './types';
|
|
88
|
+
import { EC_DEFAULT_PROPS } from '../../configs';
|
|
88
89
|
|
|
89
90
|
defineOptions({
|
|
90
91
|
options: {
|
|
@@ -117,7 +118,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
117
118
|
source: 'album',
|
|
118
119
|
columns: 4,
|
|
119
120
|
width: undefined,
|
|
120
|
-
...
|
|
121
|
+
...EC_DEFAULT_PROPS.mediaUpload,
|
|
121
122
|
});
|
|
122
123
|
|
|
123
124
|
const emit = defineEmits<{
|
|
@@ -28,11 +28,3 @@ export type ConfigurableMediaUploadProps = {
|
|
|
28
28
|
/** 自动上传文件 */
|
|
29
29
|
autoUpload?: boolean;
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
export let mediaUploadProps: ConfigurableMediaUploadProps = {};
|
|
33
|
-
|
|
34
|
-
export const setDefaultMediaUploadProps = (
|
|
35
|
-
props: ConfigurableMediaUploadProps = {}
|
|
36
|
-
) => {
|
|
37
|
-
mediaUploadProps = props;
|
|
38
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { kebabCase, pascalCase } from 'case-anything';
|
|
2
|
-
import {
|
|
2
|
+
import { EC_COMPONENT_PREFIX } from '../configs';
|
|
3
3
|
/**
|
|
4
4
|
* 给组件添加基本类名
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@ import { componentPrefix } from '../configs';
|
|
|
9
9
|
* @param componentName 组件名称
|
|
10
10
|
*/
|
|
11
11
|
const useClassNames = (componentName) => {
|
|
12
|
-
const pascalCaseClass = pascalCase(
|
|
12
|
+
const pascalCaseClass = pascalCase(EC_COMPONENT_PREFIX) + pascalCase(componentName);
|
|
13
13
|
const kebabCaseClass = kebabCase(pascalCaseClass);
|
|
14
14
|
return [pascalCaseClass, kebabCaseClass];
|
|
15
15
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { kebabCase, pascalCase } from 'case-anything';
|
|
2
|
-
import {
|
|
2
|
+
import { EC_COMPONENT_PREFIX } from '../configs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 给组件添加基本类名
|
|
@@ -11,7 +11,7 @@ import { componentPrefix } from '../configs';
|
|
|
11
11
|
*/
|
|
12
12
|
const useClassNames = (componentName: string): [string, string] => {
|
|
13
13
|
const pascalCaseClass =
|
|
14
|
-
pascalCase(
|
|
14
|
+
pascalCase(EC_COMPONENT_PREFIX) + pascalCase(componentName);
|
|
15
15
|
const kebabCaseClass = kebabCase(pascalCaseClass);
|
|
16
16
|
return [pascalCaseClass, kebabCaseClass];
|
|
17
17
|
};
|
|
@@ -44,9 +44,9 @@ declare const useMessageBoxComponent: (messageBoxRef?: Ref<InstanceType<typeof M
|
|
|
44
44
|
*
|
|
45
45
|
* @param isInPage 是否在 Page 中使用,当为 `true` 时,须将返回的 `pageRef` 绑定到 `Page` 组件上
|
|
46
46
|
*/
|
|
47
|
-
declare function useMessageBox(isInPage: true): UseMessageBoxReturn & {
|
|
47
|
+
declare function useMessageBox(isInPage: true, pageRef?: Ref<InstanceType<typeof Page> | undefined>): UseMessageBoxReturn & {
|
|
48
48
|
/** page 组件实例 */
|
|
49
|
-
pageRef: Ref<InstanceType<typeof Page
|
|
49
|
+
pageRef: Ref<InstanceType<typeof Page> | undefined>;
|
|
50
50
|
};
|
|
51
51
|
declare function useMessageBox(isInPage?: false): UseMessageBoxReturn;
|
|
52
52
|
export { useMessageBox, useMessageBoxComponent };
|
|
@@ -43,7 +43,7 @@ const useMessageBoxComponent = (messageBoxRef) => {
|
|
|
43
43
|
showMessageBox,
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
function useMessageBox(isInPage = false) {
|
|
46
|
+
function useMessageBox(isInPage = false, pageRef) {
|
|
47
47
|
if (!isInPage) {
|
|
48
48
|
const pageMessageBoxRef = inject('ecolovo/page/messageBoxRef');
|
|
49
49
|
if (!pageMessageBoxRef) {
|
|
@@ -51,18 +51,18 @@ function useMessageBox(isInPage = false) {
|
|
|
51
51
|
}
|
|
52
52
|
return useMessageBoxComponent(pageMessageBoxRef);
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const _pageRef = ref(pageRef);
|
|
55
55
|
const show = async (options) => {
|
|
56
|
-
await
|
|
56
|
+
await _pageRef.value?.show(options);
|
|
57
57
|
};
|
|
58
58
|
const showConfirm = async (options) => {
|
|
59
|
-
await
|
|
59
|
+
await _pageRef.value?.showConfirm(options);
|
|
60
60
|
};
|
|
61
61
|
const showMessageBox = async (options) => {
|
|
62
|
-
await
|
|
62
|
+
await _pageRef.value?.showMessageBox(options);
|
|
63
63
|
};
|
|
64
64
|
return {
|
|
65
|
-
pageRef,
|
|
65
|
+
pageRef: _pageRef,
|
|
66
66
|
show,
|
|
67
67
|
showConfirm,
|
|
68
68
|
showMessageBox,
|
|
@@ -122,12 +122,18 @@ const useMessageBoxComponent = (
|
|
|
122
122
|
*
|
|
123
123
|
* @param isInPage 是否在 Page 中使用,当为 `true` 时,须将返回的 `pageRef` 绑定到 `Page` 组件上
|
|
124
124
|
*/
|
|
125
|
-
function useMessageBox(
|
|
125
|
+
function useMessageBox(
|
|
126
|
+
isInPage: true,
|
|
127
|
+
pageRef?: Ref<InstanceType<typeof Page> | undefined>
|
|
128
|
+
): UseMessageBoxReturn & {
|
|
126
129
|
/** page 组件实例 */
|
|
127
|
-
pageRef: Ref<InstanceType<typeof Page
|
|
130
|
+
pageRef: Ref<InstanceType<typeof Page> | undefined>;
|
|
128
131
|
};
|
|
129
132
|
function useMessageBox(isInPage?: false): UseMessageBoxReturn;
|
|
130
|
-
function useMessageBox(
|
|
133
|
+
function useMessageBox(
|
|
134
|
+
isInPage: boolean = false,
|
|
135
|
+
pageRef?: Ref<InstanceType<typeof Page> | undefined>
|
|
136
|
+
) {
|
|
131
137
|
if (!isInPage) {
|
|
132
138
|
const pageMessageBoxRef = inject<Ref<InstanceType<typeof MessageBox>>>(
|
|
133
139
|
'ecolovo/page/messageBoxRef'
|
|
@@ -138,22 +144,22 @@ function useMessageBox(isInPage: boolean = false) {
|
|
|
138
144
|
return useMessageBoxComponent(pageMessageBoxRef);
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
const
|
|
147
|
+
const _pageRef = ref(pageRef) as Ref<InstanceType<typeof Page> | undefined>;
|
|
142
148
|
|
|
143
149
|
const show: MessageBoxShowCustomFunc = async (options) => {
|
|
144
|
-
await
|
|
150
|
+
await _pageRef.value?.show(options);
|
|
145
151
|
};
|
|
146
152
|
|
|
147
153
|
const showConfirm: MessageBoxShowConfirmFunc = async (options) => {
|
|
148
|
-
await
|
|
154
|
+
await _pageRef.value?.showConfirm(options);
|
|
149
155
|
};
|
|
150
156
|
|
|
151
157
|
const showMessageBox: MessageBoxShowMessageBoxFunc = async (options) => {
|
|
152
|
-
await
|
|
158
|
+
await _pageRef.value?.showMessageBox(options);
|
|
153
159
|
};
|
|
154
160
|
|
|
155
161
|
return {
|
|
156
|
-
pageRef,
|
|
162
|
+
pageRef: _pageRef,
|
|
157
163
|
show,
|
|
158
164
|
showConfirm,
|
|
159
165
|
showMessageBox,
|
package/composable/page.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, onMounted, ref } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { EC_TABBAR_LIST } from '../configs';
|
|
3
3
|
/** 当前页面路由 */
|
|
4
4
|
const useCurrentPageRoute = () => {
|
|
5
5
|
/** 当前页面栈 */
|
|
@@ -9,7 +9,7 @@ const useCurrentPageRoute = () => {
|
|
|
9
9
|
return currentPages.value.slice(-1)[0]?.route || '';
|
|
10
10
|
});
|
|
11
11
|
/** 当前页面是否是 tabbar 页面,需配置 tabbarList */
|
|
12
|
-
const isTabbarPage = computed(() =>
|
|
12
|
+
const isTabbarPage = computed(() => EC_TABBAR_LIST.findIndex((item) => item.pagePath === currentPageRoute.value) >= 0);
|
|
13
13
|
onMounted(() => {
|
|
14
14
|
currentPages.value = getCurrentPages() || [];
|
|
15
15
|
});
|
package/composable/page.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, onMounted, ref } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { EC_TABBAR_LIST } from '../configs';
|
|
3
3
|
|
|
4
4
|
/** 当前页面路由 */
|
|
5
5
|
const useCurrentPageRoute = () => {
|
|
@@ -12,7 +12,7 @@ const useCurrentPageRoute = () => {
|
|
|
12
12
|
/** 当前页面是否是 tabbar 页面,需配置 tabbarList */
|
|
13
13
|
const isTabbarPage = computed(
|
|
14
14
|
() =>
|
|
15
|
-
|
|
15
|
+
EC_TABBAR_LIST.findIndex(
|
|
16
16
|
(item) => item.pagePath === currentPageRoute.value
|
|
17
17
|
) >= 0
|
|
18
18
|
);
|
package/configs/index.d.ts
CHANGED
|
@@ -1,49 +1,13 @@
|
|
|
1
1
|
import type { TabBarItem } from '@ecolovo/utils';
|
|
2
2
|
/** 组件前缀 */
|
|
3
|
-
declare
|
|
3
|
+
export declare const EC_COMPONENT_PREFIX = "app";
|
|
4
4
|
/** 首页路径 */
|
|
5
|
-
declare
|
|
5
|
+
export declare const EC_HOME_PATH = "/pages/index/index";
|
|
6
|
+
/** iconFont json 文件列表 */
|
|
7
|
+
export declare const EC_ICON_FONT: IconFontJson[];
|
|
8
|
+
/** 是否使用内部 iconFont */
|
|
9
|
+
export declare const EC_USE_INNER_ICON = true;
|
|
6
10
|
/** tabbar 列表 */
|
|
7
|
-
declare
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* @param prefix 组件前缀
|
|
12
|
-
*/
|
|
13
|
-
declare function setComponentPrefix(prefix?: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* 设置首页路径
|
|
16
|
-
*
|
|
17
|
-
* @param path 首页路径
|
|
18
|
-
*/
|
|
19
|
-
declare function setHomePath(path?: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* 设置 tabbar 列表
|
|
22
|
-
*
|
|
23
|
-
* @param list tabbar 列表
|
|
24
|
-
*/
|
|
25
|
-
declare function setTabbarList(list?: TabBarItem[]): void;
|
|
26
|
-
interface IconInfo {
|
|
27
|
-
/** 字体文件名 */
|
|
28
|
-
fontFamily: string;
|
|
29
|
-
/** 图标前缀 */
|
|
30
|
-
prefix: string;
|
|
31
|
-
/** 图标名称 */
|
|
32
|
-
name: string;
|
|
33
|
-
}
|
|
34
|
-
/** iconfont 图标 map */
|
|
35
|
-
declare const iconMap: Map<string, IconInfo>;
|
|
36
|
-
export interface IconFontJson {
|
|
37
|
-
font_family: string;
|
|
38
|
-
css_prefix_text: string;
|
|
39
|
-
glyphs: {
|
|
40
|
-
font_class: string;
|
|
41
|
-
}[];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 添加一组图标,传入 iconfont.json 文件内容
|
|
45
|
-
*
|
|
46
|
-
* @param iconJson iconfont.json 文件内容
|
|
47
|
-
*/
|
|
48
|
-
declare function addIcons(iconJson: IconFontJson): void;
|
|
49
|
-
export { componentPrefix, homePath, tabbarList, setComponentPrefix, setHomePath, setTabbarList, iconMap, addIcons, };
|
|
11
|
+
export declare const EC_TABBAR_LIST: TabBarItem[];
|
|
12
|
+
/** 组件默认属性配置 */
|
|
13
|
+
export declare const EC_DEFAULT_PROPS: ComponentsProps;
|