@mpxjs/core 2.8.0-beta.4 → 2.8.0-beta.5

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 CHANGED
@@ -618,7 +618,7 @@ export function onTabItemTap (callback: () => void): void
618
618
  export function onSaveExitState (callback: () => void): void
619
619
 
620
620
  // get instance
621
- export function getCurrentInstance<T extends object> (): { target: T }
621
+ export function getCurrentInstance<T extends object> (): T
622
622
 
623
623
  // I18n
624
624
  export function useI18n<Options extends {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.8.0-beta.4",
3
+ "version": "2.8.0-beta.5",
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": "7a3dd6c2d0fceb31ee035e85b7f11091e31409d3"
50
+ "gitHead": "4e1d6b16c406d3caac0dabb4fae9bc16ac330755"
51
51
  }
package/src/core/proxy.js CHANGED
@@ -578,7 +578,7 @@ export default class MpxProxy {
578
578
 
579
579
  export let currentInstance = null
580
580
 
581
- export const getCurrentInstance = () => currentInstance
581
+ export const getCurrentInstance = () => currentInstance?.target
582
582
 
583
583
  export const setCurrentInstance = (instance) => {
584
584
  currentInstance = instance
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  effectScope as vueEffectScope,
3
3
  getCurrentScope as getCurrentVueScope,
4
- onScopeDispose,
5
- getCurrentInstance as getCurrentVueInstance
4
+ onScopeDispose
6
5
  } from 'vue'
7
6
 
8
7
  export {
@@ -28,7 +27,9 @@ export {
28
27
  shallowRef,
29
28
  triggerRef,
30
29
  // computed
31
- computed
30
+ computed,
31
+ // instance
32
+ getCurrentInstance
32
33
  } from 'vue'
33
34
 
34
35
  const noop = () => {
@@ -43,17 +44,12 @@ const effectScope = (detached) => fixEffectScope(vueEffectScope(detached))
43
44
  const getCurrentScope = () => fixEffectScope(getCurrentVueScope())
44
45
 
45
46
  export {
47
+ // effectScope
46
48
  effectScope,
47
49
  getCurrentScope,
48
50
  onScopeDispose
49
51
  }
50
52
 
51
- const getCurrentInstance = () => getCurrentVueInstance()?.__mpxProxy
52
-
53
- export {
54
- getCurrentInstance
55
- }
56
-
57
53
  export {
58
54
  // i18n
59
55
  useI18n