@mpxjs/core 2.8.19 → 2.8.21

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
@@ -639,7 +639,7 @@ export const ONHIDE: string
639
639
  export const ONRESIZE: string
640
640
 
641
641
  declare global {
642
- const defineProps: <T>(props: T) => Readonly<GetPropsType<T>>
642
+ const defineProps: (<T>(props: T) => Readonly<GetPropsType<T>>) & (<T>() => Readonly<T>)
643
643
  const defineOptions: <D extends Data = {}, P extends Properties = {}, C = {}, M extends Methods = {}, Mi extends Array<any> = [], S extends AnyObject = {}, O extends AnyObject = {}> (opt: ThisTypedComponentOpt<D, P, C, M, Mi, S, O>) => void
644
644
  const defineExpose: <E extends AnyObject = AnyObject>(exposed?: E) => void
645
645
  const useContext: () => Context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.8.19",
3
+ "version": "2.8.21",
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": "fca1b61f52c2ed8b3926e7b8a3a150d27904911a"
50
+ "gitHead": "976455b62ed3cd98c7e58d7daca99fd8abb4b5fa"
51
51
  }
package/src/core/proxy.js CHANGED
@@ -121,11 +121,12 @@ export default class MpxProxy {
121
121
  this.currentRenderTask = null
122
122
  }
123
123
  this.initApi()
124
- this.callHook(BEFORECREATE)
125
124
  }
126
125
 
127
126
  created () {
128
127
  if (__mpx_mode__ !== 'web') {
128
+ // web中BEFORECREATE钩子通过vue的beforeCreate钩子单独驱动
129
+ this.callHook(BEFORECREATE)
129
130
  setCurrentInstance(this)
130
131
  this.initProps()
131
132
  this.initSetup()
@@ -3,7 +3,7 @@ import mergeOptions from '../../../core/mergeOptions'
3
3
  import { diffAndCloneA, hasOwn } from '@mpxjs/utils'
4
4
  import { getCurrentInstance as getCurrentVueInstance } from '../../export/index'
5
5
  import MpxProxy, { setCurrentInstance, unsetCurrentInstance } from '../../../core/proxy'
6
- import { BEFOREUPDATE, UPDATED, BEFOREUNMOUNT, UNMOUNTED } from '../../../core/innerLifecycle'
6
+ import { BEFORECREATE, BEFOREUPDATE, UPDATED, BEFOREUNMOUNT, UNMOUNTED } from '../../../core/innerLifecycle'
7
7
 
8
8
  function filterOptions (options) {
9
9
  const newOptions = {}
@@ -30,8 +30,10 @@ function filterOptions (options) {
30
30
  function initProxy (context, rawOptions) {
31
31
  if (!context.__mpxProxy) {
32
32
  context.__mpxProxy = new MpxProxy(rawOptions, context)
33
+ context.__mpxProxy.callHook(BEFORECREATE)
33
34
  } else if (context.__mpxProxy.isUnmounted()) {
34
35
  context.__mpxProxy = new MpxProxy(rawOptions, context, true)
36
+ context.__mpxProxy.callHook(BEFORECREATE)
35
37
  }
36
38
  }
37
39