@mpxjs/core 2.8.25-alpha.3 → 2.8.25-alpha.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.8.25-alpha.3",
3
+ "version": "2.8.25-alpha.4",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -49,5 +49,5 @@
49
49
  "url": "https://github.com/didi/mpx/issues"
50
50
  },
51
51
  "sideEffects": false,
52
- "gitHead": "a4acf4b86fc634513b77614453d28027f2b37762"
52
+ "gitHead": "9684484c1b348bcb8d8325df75a114ba9611811e"
53
53
  }
@@ -2,7 +2,7 @@ import {
2
2
  effectScope as vueEffectScope,
3
3
  getCurrentScope as getCurrentVueScope,
4
4
  onScopeDispose
5
- } from 'vue'
5
+ } from '@hummer/tenon-vue'
6
6
 
7
7
  export {
8
8
  // watch
@@ -30,7 +30,7 @@ export {
30
30
  computed,
31
31
  // instance
32
32
  getCurrentInstance
33
- } from 'vue'
33
+ } from '@hummer/tenon-vue'
34
34
 
35
35
  const noop = () => {
36
36
  }
@@ -2,7 +2,7 @@ import builtInKeysMap from '../builtInKeysMap'
2
2
  import mergeOptions from '../../../core/mergeOptions'
3
3
  import { getCurrentInstance as getCurrentVueInstance } from '../../export/index'
4
4
  import MpxProxy, { setCurrentInstance, unsetCurrentInstance } from '../../../core/proxy'
5
- import { diffAndCloneA } from '@mpxjs/utils'
5
+ import { diffAndCloneA, warn } from '@mpxjs/utils'
6
6
  import { UPDATED, CREATED, MOUNTED, UNMOUNTED } from '../../../core/innerLifecycle'
7
7
 
8
8
  function filterOptions (options) {
@@ -37,17 +37,30 @@ export function getDefaultOptions (type, { rawOptions = {}, currentInject }) {
37
37
  const rawSetup = rawOptions.setup
38
38
  if (rawSetup) {
39
39
  rawOptions.setup = (props) => {
40
- const instance = getCurrentVueInstance().proxy
40
+ const { proxy: instance } = getCurrentVueInstance()
41
41
  initProxy(instance, rawOptions)
42
42
  setCurrentInstance(instance.__mpxProxy)
43
43
  const newContext = {
44
- triggerEvent: instance.triggerEvent.bind(instance),
45
- refs: instance.$refs,
44
+ triggerEvent: (eventName, eventDetail) => {
45
+ return instance.$emit(eventName, {
46
+ type: eventName,
47
+ detail: eventDetail
48
+ })
49
+ },
50
+ get refs () { return instance.$refs },
46
51
  forceUpdate: instance.$forceUpdate.bind(instance),
47
- selectComponent: instance.selectComponent.bind(instance),
48
- selectAllComponents: instance.selectAllComponents.bind(instance),
49
- createSelectorQuery: instance.createSelectorQuery.bind(instance),
50
- createIntersectionObserver: instance.createIntersectionObserver.bind(instance)
52
+ selectComponent: () => {
53
+ warn('selectComponent is not supported in Tenon')
54
+ },
55
+ selectAllComponents: () => {
56
+ warn('selectAllComponents is not supported in Tenon')
57
+ },
58
+ createSelectorQuery: () => {
59
+ warn('createSelectorQuery is not supported in Tenon')
60
+ },
61
+ createIntersectionObserver: () => {
62
+ warn('createIntersectionObserver is not supported in Tenon')
63
+ }
51
64
  }
52
65
  const setupRes = rawSetup(props, newContext)
53
66
  unsetCurrentInstance(instance.__mpxProxy)