@mpxjs/core 2.8.4 → 2.8.6
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/@types/index.d.ts +24 -21
- package/package.json +2 -2
- package/src/convertor/wxToTt.js +17 -1
package/@types/index.d.ts
CHANGED
|
@@ -8,18 +8,11 @@
|
|
|
8
8
|
/// <reference path="./node.d.ts" />
|
|
9
9
|
|
|
10
10
|
// @ts-ignore
|
|
11
|
-
import VueI18n from 'vue-i18n'
|
|
12
|
-
|
|
13
11
|
import type { GetComputedType } from '@mpxjs/store'
|
|
14
12
|
|
|
13
|
+
// @ts-ignore
|
|
15
14
|
export * from '@mpxjs/store'
|
|
16
15
|
|
|
17
|
-
declare module 'vue-i18n' {
|
|
18
|
-
export default interface VueI18n {
|
|
19
|
-
mergeMessages (messages: { [index: string]: VueI18n.LocaleMessageObject }): void;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
16
|
// utils
|
|
24
17
|
type ObjectOf<T> = {
|
|
25
18
|
[key: string]: T
|
|
@@ -428,7 +421,7 @@ type WatchSource<T> =
|
|
|
428
421
|
| (() => T) // getter
|
|
429
422
|
| ComputedRef<T>
|
|
430
423
|
|
|
431
|
-
|
|
424
|
+
type MultiWatchSources = (WatchSource<unknown> | object)[]
|
|
432
425
|
|
|
433
426
|
interface WatchEffectOptions {
|
|
434
427
|
flush?: 'pre' | 'post' | 'sync' // default: 'pre'
|
|
@@ -528,7 +521,15 @@ export function watchPostEffect (
|
|
|
528
521
|
options?: WatchEffectOptions
|
|
529
522
|
): void
|
|
530
523
|
|
|
531
|
-
|
|
524
|
+
|
|
525
|
+
export function watch<T extends MultiWatchSources> (
|
|
526
|
+
sources: [...T],
|
|
527
|
+
callback: WatchCallback<{
|
|
528
|
+
[K in keyof T]: T[K] extends WatchSource<infer V> ? V : T[K] extends object ? T[K] : never
|
|
529
|
+
}>,
|
|
530
|
+
options?: WatchOptions
|
|
531
|
+
): () => void
|
|
532
|
+
export function watch<T extends Readonly<MultiWatchSources>> (
|
|
532
533
|
sources: T,
|
|
533
534
|
callback: WatchCallback<{
|
|
534
535
|
[K in keyof T]: T[K] extends WatchSource<infer V> ? V : T[K] extends object ? T[K] : never
|
|
@@ -572,27 +573,29 @@ export function onBeforeUnmount (callback: () => void): void
|
|
|
572
573
|
|
|
573
574
|
export function onUnmounted (callback: () => void): void
|
|
574
575
|
|
|
575
|
-
export function onLoad<T extends
|
|
576
|
+
export function onLoad<T extends Record<string, string | undefined>> (callback: (query: T) => void): void
|
|
577
|
+
// wechat dose not have generics
|
|
578
|
+
// export function onLoad (callback: WechatMiniprogram.Page.ILifetime['onLoad']): void
|
|
576
579
|
|
|
577
|
-
export function onShow (callback:
|
|
580
|
+
export function onShow (callback: WechatMiniprogram.Page.ILifetime['onShow']): void
|
|
578
581
|
|
|
579
|
-
export function onHide (callback:
|
|
582
|
+
export function onHide (callback: WechatMiniprogram.Page.ILifetime['onHide']): void
|
|
580
583
|
|
|
581
|
-
export function onResize (callback:
|
|
584
|
+
export function onResize (callback: WechatMiniprogram.Page.ILifetime['onResize']): void
|
|
582
585
|
|
|
583
|
-
export function onPullDownRefresh (callback:
|
|
586
|
+
export function onPullDownRefresh (callback: WechatMiniprogram.Page.ILifetime['onPullDownRefresh']): void
|
|
584
587
|
|
|
585
|
-
export function onReachBottom (callback:
|
|
588
|
+
export function onReachBottom (callback: WechatMiniprogram.Page.ILifetime['onReachBottom']): void
|
|
586
589
|
|
|
587
|
-
export function onShareAppMessage (callback:
|
|
590
|
+
export function onShareAppMessage (callback: WechatMiniprogram.Page.ILifetime['onShareAppMessage']): void
|
|
588
591
|
|
|
589
|
-
export function onShareTimeline (callback:
|
|
592
|
+
export function onShareTimeline (callback: WechatMiniprogram.Page.ILifetime['onShareTimeline']): void
|
|
590
593
|
|
|
591
|
-
export function onAddToFavorites (callback:
|
|
594
|
+
export function onAddToFavorites (callback: WechatMiniprogram.Page.ILifetime['onAddToFavorites']): void
|
|
592
595
|
|
|
593
|
-
export function onPageScroll (callback:
|
|
596
|
+
export function onPageScroll (callback: WechatMiniprogram.Page.ILifetime['onPageScroll']): void
|
|
594
597
|
|
|
595
|
-
export function onTabItemTap (callback:
|
|
598
|
+
export function onTabItemTap (callback: WechatMiniprogram.Page.ILifetime['onTabItemTap']): void
|
|
596
599
|
|
|
597
600
|
export function onSaveExitState (callback: () => void): void
|
|
598
601
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.6",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "c4261c7ea5a16ee3ceaac78afad09e5e0b35d39a"
|
|
51
51
|
}
|
package/src/convertor/wxToTt.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import { error } from '@mpxjs/utils'
|
|
2
|
+
|
|
3
|
+
const BEHAVIORS_MAP = [
|
|
4
|
+
'wx://form-field',
|
|
5
|
+
'wx://form-field-group',
|
|
6
|
+
'wx://form-field-button',
|
|
7
|
+
'wx://component-export'
|
|
8
|
+
]
|
|
9
|
+
|
|
1
10
|
export default {
|
|
2
11
|
convert (options) {
|
|
3
|
-
|
|
12
|
+
if (options.behaviors) {
|
|
13
|
+
options.behaviors.forEach((behavior, idx) => {
|
|
14
|
+
if (BEHAVIORS_MAP.includes(behavior)) {
|
|
15
|
+
error(`Built-in behavior "${behavior}" is not supported in tt environment!`, global.currentResource)
|
|
16
|
+
options.behaviors.splice(idx, 1)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
4
20
|
}
|
|
5
21
|
}
|