WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/// <reference path="./comps.d.ts" />
type Func = import('./func').Func
declare module 'uview-plus' {
  export function install(
    vm: import('vue').App,
    upuiParams?: () => {
      httpIns?: (http: HttpRequest) => void;
      options?: Partial<GlobalConfig>;
    }
  ): void; //必要
    type test = import('./func').test
    type RouteParam = import('./func').RouteParam
    type HttpRequest = InstanceType<typeof import('../libs/luch-request')['default']>
    interface Config {
        v: string;
        version: string;
        color: Partial<Color>;
        /**
         * - 修改默认单位,相当于执行 uni.$u.config.unit = 'rpx'
         * - 组件的很多单位仍然为px并非配置不生效,而是rpx配置目前无法做到修改Vue单文件组件中的Css/Sass中写死的px单位。
         * - 这个配置主要用于prop传参时的单位修改,比如<up-image width="80"></up-image>中的80会是rpx单位。
         * - 如果需要全局组件样式变为rpx,可以尝试使用postcss等第三方插件转换。
         * @default 'px'
         */
        unit: 'px' | 'rpx';
        /** 
         * 只加载一次字体图标
         * @default false
         */
        loadFontOnce: boolean;
        /** 
         * 扩充自定义字体图标
         * @version 3.4.14
         */
        customIcon: {
            /** 字体族名称 */
            family: string;
            /** ttf文件远程链接 */
            url: string;
        };
        /** 
         * unicode映射表,为了更直观书写,语义更明确
         * - 如'light-mode': '\ue66c'
         * - <up-icon customPrefix="xyicon" name="light-mode"></up-icon>
         */
        customIcons: {
            [key: string]: string
        }
    }
    interface Color {
        primary: string,
        info: string,
        default: string,
        warning: string,
        error: string,
        success: string,
        mainColor: string,
        contentColor: string,
        tipsColor: string,
        lightColor: string,
        borderColor: string
    }
    interface GlobalConfig {
        config: Partial<Config>;
        props: {};
    }
    interface $u extends Func {
        test: test;
        type: {},
        http: HttpRequest,
        config: Config;
        zIndex: {
            toast: number;
            noNetwork: number;
            // popup包含popup,actionsheet,keyboard,picker的值
            popup: number;
            mask: number;
            navbar: number;
            topTips: number;
            sticky: number;
            indexListSticky: number;
        },
        mixin: {},
        mpMixin: {},
        props: {},
        color: Color;
        platform: string;
    }
 
    export function setConfig(config: Partial<GlobalConfig>): void;
    // 可单独导入使用,也可以在 uni.$u 中使用
    export const test: $u['test']
    export const http: $u['http']
    export const config: $u['config']
    export const platform: $u['platform']
    export const range: $u['range']
    export const getPx: $u['getPx']
    export const rpx2px: $u['rpx2px']
    export const sleep: $u['sleep']
    export const os: $u['os']
    export const sys: $u['sys']
    export const random: $u['random']
    export const guid: $u['guid']
    export const addStyle: $u['addStyle']
    export const addUnit: $u['addUnit']
    export const timeFormat: $u['timeFormat']
    export const timeFrom: $u['timeFrom']
    export const trim: $u['trim']
    export const queryParams: $u['queryParams']
    export const toast: $u['toast']
    export const priceFormat: $u['priceFormat']
    export const genLightColor: $u['genLightColor']
    export const debounce: $u['debounce']
    export const throttle: $u['throttle']
    export const colorGradient: $u['colorGradient']
    export const hexToRgb: $u['hexToRgb']
    export const rgbToHex: $u['rgbToHex']
    export const colorToRgba: $u['colorToRgba']
    export const route: $u['route']
 
    global {
        interface Uni {
            $u: $u
        }
    }
}
declare type UniCountDownRef = typeof import('./comps/countDown')['CountDownRef']
declare type UniCountToRef = typeof import('./comps/countTo')['CountToRef']
declare type UniReadMoreRef = typeof import('./comps/readMore')['ReadMoreRef']
declare type UniToastRef = typeof import('./comps/toast')['ToastRef']
declare type UniCollapseRef = typeof import('./comps/collapse')['CollapseRef']
declare type UniNotifyRef = typeof import('./comps/notify')['NotifyRef']
declare type UniCodeRef = typeof import('./comps/code')['CodeRef']
declare type UniInputRef = typeof import('./comps/input')['InputRef']
declare type UniUploadRef = typeof import('./comps/upload')['UploadRef']
declare type UniDatetimePickerRef = typeof import('./comps/datetimePicker')['DatetimePickerRef']
declare type UniPickerRef = typeof import('./comps/picker')['PickerRef']
declare type UniCalendarRef = typeof import('./comps/calendar')['CalendarRef']
declare type UniTextareaRef = typeof import('./comps/textarea')['TextareaRef']
declare type UniFormRef = typeof import('./comps/form')['FormRef']