1 | import Taro from './index'
|
2 |
|
3 | declare module './index' {
|
4 | |
5 |
|
6 |
|
7 | interface CommonConfig {
|
8 | |
9 |
|
10 |
|
11 | navigationBarBackgroundColor?: string
|
12 | |
13 |
|
14 |
|
15 | navigationBarTextStyle?: 'white' | 'black'
|
16 |
|
17 | navigationBarTitleText?: string
|
18 | |
19 |
|
20 |
|
21 |
|
22 | navigationStyle?: 'default' | 'custom'
|
23 | |
24 |
|
25 |
|
26 | backgroundColor?: string
|
27 | |
28 |
|
29 |
|
30 | backgroundTextStyle?: 'dark' | 'light'
|
31 | |
32 |
|
33 |
|
34 | backgroundColorTop?: string
|
35 | |
36 |
|
37 |
|
38 | backgroundColorBottom?: string
|
39 | |
40 |
|
41 |
|
42 | enablePullDownRefresh?: boolean
|
43 | |
44 |
|
45 |
|
46 | onReachBottomDistance?: number
|
47 | |
48 |
|
49 |
|
50 | pageOrientation?: 'auto' | 'portrait' | 'landscape'
|
51 |
|
52 | initialRenderingCache?: 'static' | 'dynamic'
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 | restartStrategy?: 'homePage' | 'homePageAndLatestPage'
|
59 | }
|
60 |
|
61 | interface PageConfig extends CommonConfig {
|
62 | |
63 |
|
64 |
|
65 |
|
66 | disableScroll?: boolean
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | disableSwipeBack?: boolean
|
75 | |
76 |
|
77 |
|
78 | enableShareAppMessage?: boolean
|
79 | |
80 |
|
81 |
|
82 | enableShareTimeline?: boolean
|
83 | |
84 |
|
85 |
|
86 | usingComponents?: Record<string, string>
|
87 | |
88 |
|
89 |
|
90 |
|
91 | style?: string
|
92 |
|
93 | singlePage?: SinglePage
|
94 | }
|
95 |
|
96 | interface WindowConfig extends CommonConfig {
|
97 | |
98 |
|
99 |
|
100 | visualEffectInBackground?: 'hidden' | 'none'
|
101 | |
102 |
|
103 |
|
104 |
|
105 | pullRefresh?: 'YES' | 'NO' | boolean
|
106 | |
107 |
|
108 |
|
109 | allowsBounceVertical?: 'YES' | 'NO'
|
110 | }
|
111 |
|
112 | interface TabBarItem {
|
113 |
|
114 | pagePath: string
|
115 |
|
116 | text: string
|
117 |
|
118 | iconPath?: string
|
119 |
|
120 | selectedIconPath?: string
|
121 | }
|
122 |
|
123 | interface TabBar {
|
124 |
|
125 | color?: string
|
126 |
|
127 | selectedColor?: string
|
128 |
|
129 | backgroundColor?: string
|
130 | |
131 |
|
132 |
|
133 | borderStyle?: 'black' | 'white'
|
134 |
|
135 | list: TabBarItem[]
|
136 | |
137 |
|
138 |
|
139 | position?: 'bottom' | 'top'
|
140 | |
141 |
|
142 |
|
143 |
|
144 | custom?: boolean
|
145 | }
|
146 |
|
147 | interface NetworkTimeout {
|
148 | |
149 |
|
150 |
|
151 | request?: number
|
152 | |
153 |
|
154 |
|
155 | connectSocket?: number
|
156 | |
157 |
|
158 |
|
159 | uploadFile?: number
|
160 | |
161 |
|
162 |
|
163 | downloadFile?: number
|
164 | }
|
165 |
|
166 | interface SubPackage {
|
167 | |
168 |
|
169 |
|
170 | root: string
|
171 |
|
172 | pages: string[]
|
173 |
|
174 | name?: string
|
175 |
|
176 | independent?: boolean
|
177 |
|
178 | plugins?: Plugins
|
179 | }
|
180 |
|
181 | interface Plugins {
|
182 | [key: string]: {
|
183 | version: string
|
184 | provider: string
|
185 | }
|
186 | }
|
187 |
|
188 | interface PreloadRule {
|
189 | [key: string]: {
|
190 |
|
191 | packages: string[]
|
192 | |
193 |
|
194 |
|
195 |
|
196 |
|
197 | network?: 'all' | 'wifi'
|
198 | }
|
199 | }
|
200 |
|
201 | interface Permission {
|
202 | [key: string]: {
|
203 |
|
204 | desc: string
|
205 | }
|
206 | }
|
207 |
|
208 | interface SinglePage {
|
209 | |
210 |
|
211 |
|
212 | navigationBarFit?: string
|
213 | }
|
214 |
|
215 | interface RouterAnimate {
|
216 | |
217 |
|
218 |
|
219 | duration?: number
|
220 | |
221 |
|
222 |
|
223 | delay?: number
|
224 | }
|
225 |
|
226 | interface AppConfig {
|
227 |
|
228 | entryPagePath?: string
|
229 |
|
230 | pages?: string[]
|
231 |
|
232 | window?: WindowConfig
|
233 |
|
234 | tabBar?: TabBar
|
235 |
|
236 | networkTimeout?: NetworkTimeout
|
237 | |
238 |
|
239 |
|
240 | debug?: boolean
|
241 | |
242 |
|
243 |
|
244 |
|
245 |
|
246 | functionalPages?: boolean
|
247 | /** 分包结构配置
|
248 | * @example
|
249 | * ```json
|
250 | * [
|
251 | * {
|
252 | * root: 'packages/module',
|
253 | * pages: [
|
254 | * 'pages/page/index'
|
255 | * ]
|
256 | * }
|
257 | * ]
|
258 | * ```
|
259 | * @since 1.7.3
|
260 | */
|
261 | subPackages?: SubPackage[]
|
262 | subpackages?: SubPackage[]
|
263 | /** Worker 代码放置的目录
|
264 | * 使用 Worker 处理多线程任务时,设置 Worker 代码放置的目录
|
265 | * @since 1.9.90
|
266 | */
|
267 | workers?: string
|
268 | /** 申明需要后台运行的能力,类型为数组。目前支持以下项目:
|
269 | * - audio: 后台音乐播放
|
270 | * - location: 后台定位
|
271 | * @since 微信客户端 6.7.2 及以上版本支持
|
272 | */
|
273 | requiredBackgroundModes?: ('audio' | 'location')[]
|
274 | /** 使用到的插件
|
275 | * @since 1.9.6
|
276 | */
|
277 | plugins?: Plugins
|
278 | /** 声明分包预下载的规则。
|
279 | * preloadRule 中,key 是页面路径,value 是进入此页面的预下载配置
|
280 | * 注意: 分包预下载目前只支持通过配置方式使用,暂不支持通过调用API完成。
|
281 | * vConsole 里有 preloadSubpackages 开头的日志信息,可以用来验证预下载的情况。
|
282 | * @since 2.3.0
|
283 | */
|
284 | preloadRule?: PreloadRule
|
285 | /** PC 小程序是否支持用户任意改变窗口大小(包括最大化窗口);iPad 小程序是否支持屏幕旋转
|
286 | * @default false
|
287 | * @since 2.3.0
|
288 | */
|
289 | resizable?: boolean
|
290 | /** 需要跳转的小程序列表
|
291 | * @since 2.4.0
|
292 | */
|
293 | navigateToMiniProgramAppIdList?: string[]
|
294 | /** 全局自定义组件配置
|
295 | * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
|
296 | */
|
297 | usingComponents?: Record<string, string>
|
298 | /** 小程序接口权限相关设置
|
299 | * @since 微信客户端 7.0.0
|
300 | */
|
301 | permission?: Permission
|
302 | /** 指明 sitemap.json 的位置 */
|
303 | sitemapLocation?: string
|
304 | /** 指定使用升级后的 weui 样式
|
305 | * - v2: 可表明启用新版的组件样式
|
306 | * @default default
|
307 | */
|
308 | style?: string
|
309 | /** 指定需要引用的扩展库
|
310 | * 指定需要引用的扩展库。目前支持以下项目:
|
311 | * - kbone: 多端开发框架
|
312 | * - weui: WeUI 组件库
|
313 | */
|
314 | useExtendedLib?: Record<string, boolean>
|
315 | /** 微信消息用小程序打开
|
316 | * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/location-message.html
|
317 | */
|
318 | entranceDeclare?: {
|
319 | /** 声明“位置消息”场景进入小程序的启动页面 */
|
320 | locationMessage?: {
|
321 | /** 启动页路径,必须是在pages中已经定义 */
|
322 | path?: string
|
323 | /** 启动页参数 */
|
324 | query?: string
|
325 | }
|
326 | }
|
327 | /**
|
328 | * 配置 darkMode 为 true,即表示当前小程序已适配 DarkMode
|
329 | * @since 2.11.0
|
330 | */
|
331 | darkmode?: boolean
|
332 | /** 指明 theme.json 的位置,darkmode为true为必填
|
333 | * @since 2.11.0
|
334 | */
|
335 | themeLocation?: string
|
336 | /** 配置自定义组件代码按需注入 */
|
337 | lazyCodeLoading?: string
|
338 | /** 单页模式相关配置 */
|
339 | singlePage?: SinglePage
|
340 | /** 聊天素材小程序打开相关配置
|
341 | * @see https://developers.weixin.qq.com/miniprogram/dev/framework/material/support_material.html
|
342 | */
|
343 | supportedMaterials?: {
|
344 | /** 支持文件类型的MimeType,音频,视频支持二级配置的通配模式,例如: video/*。通配模式配置和精确类型配置同时存在时,则优先使用精确类型的配置(例如video/*和video/mp4同时存在,会优先使用video/mp4的配置)。 */
|
345 | materialType: string
|
346 | /** 开发者配置的标题,在素材页面会展示该标题,配置中必须包含${nickname}, 代码包编译后会自动替换为小程序名称,如果声明了简称则会优先使用简称。除去${nickname}其余字数不得超过6个。 */
|
347 | name: string
|
348 | /** 用途描述,会在推荐列表展示该描述,限定字数不超过22个。 */
|
349 | desc: string
|
350 | /** 在该场景下打开小程序时跳转页面 */
|
351 | path: string
|
352 | }
|
353 | /** 定制化型服务商票据 */
|
354 | serviceProviderTicket?: string
|
355 | /** 半屏小程序 appId */
|
356 | embeddedAppIdList?: string[]
|
357 | /** 视频号直播半屏场景设置 */
|
358 | halfPage?: {
|
359 | /** 视频号直播打开的第一个页面的全屏状态使用自定义顶部,支持 */
|
360 | firstPageNavigationStyle?: 'default' | 'custom'
|
361 | }
|
362 | /** 接受一个数组,每一项都是字符串,来指定编译为原生小程序组件的组件入口 */
|
363 | components?: string[]
|
364 | /** 渲染页面的容器 id
|
365 | * @default "app"
|
366 | * @since 3.3.18
|
367 | */
|
368 | appId?: string
|
369 | /** 是否开启 h5 端路由动画功能,默认开启
|
370 | * @supported h5
|
371 | * @since 3.3.18
|
372 | */
|
373 | animation?: RouterAnimate | boolean
|
374 | }
|
375 |
|
376 | interface Config extends PageConfig, AppConfig {
|
377 | cloud?: boolean
|
378 | }
|
379 |
|
380 | interface TaroStatic {
|
381 | CommonConfig: CommonConfig
|
382 | PageConfig: PageConfig
|
383 | WindowConfig: WindowConfig
|
384 | TarBarList: TabBarItem
|
385 | TabBar: TabBar
|
386 | NetworkTimeout: NetworkTimeout
|
387 | SubPackage: SubPackage
|
388 | Plugins: Plugins
|
389 | PreloadRule: PreloadRule
|
390 | Permission: Permission
|
391 | AppConfig: AppConfig
|
392 | RouterAnimate: RouterAnimate
|
393 | Config: Config
|
394 | }
|
395 | }
|
396 |
|
397 |
|
\ | No newline at end of file |