@mpxjs/core 2.8.60 → 2.8.61

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.60",
3
+ "version": "2.8.61",
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": "02a77bf602744c35703b2fdc27171edbec09edcb"
50
+ "gitHead": "f393ffc439f21b24f5f09a65ef99db20b145e19a"
51
51
  }
package/src/core/proxy.js CHANGED
@@ -541,6 +541,7 @@ export default class MpxProxy {
541
541
  const _i = this.target._i.bind(this.target)
542
542
  const _c = this.target._c.bind(this.target)
543
543
  const _r = this.target._r.bind(this.target)
544
+ const _sc = this.target._sc.bind(this.target)
544
545
  const effect = this.effect = new ReactiveEffect(() => {
545
546
  // pre render for props update
546
547
  if (this.propsUpdatedFlag) {
@@ -549,7 +550,7 @@ export default class MpxProxy {
549
550
 
550
551
  if (this.target.__injectedRender) {
551
552
  try {
552
- return this.target.__injectedRender(_i, _c, _r)
553
+ return this.target.__injectedRender(_i, _c, _r, _sc)
553
554
  } catch (e) {
554
555
  warn('Failed to execute render function, degrade to full-set-data mode.', this.options.mpxFileResource, e)
555
556
  this.render()
@@ -1,4 +1,4 @@
1
- import { isObject, getByPath, hasOwn } from '@mpxjs/utils'
1
+ import { getByPath, hasOwn, isObject } from '@mpxjs/utils'
2
2
 
3
3
  export default function renderHelperMixin () {
4
4
  return {
@@ -21,6 +21,7 @@ export default function renderHelperMixin () {
21
21
  }
22
22
  }
23
23
  },
24
+ // collect
24
25
  _c (key, value) {
25
26
  if (hasOwn(this.__mpxProxy.renderData, key)) {
26
27
  return this.__mpxProxy.renderData[key]
@@ -31,6 +32,10 @@ export default function renderHelperMixin () {
31
32
  this.__mpxProxy.renderData[key] = value
32
33
  return value
33
34
  },
35
+ // simple collect
36
+ _sc (key) {
37
+ return (this.__mpxProxy.renderData[key] = this[key])
38
+ },
34
39
  _r () {
35
40
  this.__mpxProxy.renderWithData()
36
41
  }
package/src/vuePlugin.js CHANGED
@@ -17,6 +17,11 @@ function collectDataset (attrs) {
17
17
 
18
18
  export default function install (Vue) {
19
19
  Vue.prototype.triggerEvent = function (eventName, eventDetail) {
20
+ // 输出Web时自定义组件绑定click事件会和web原生事件冲突,组件内部triggerEvent时会导致事件执行两次,将click事件改为_click来规避此问题
21
+ const escapeEvents = ['click']
22
+ if (escapeEvents.includes(eventName)) {
23
+ eventName = '_' + eventName
24
+ }
20
25
  let eventObj = {}
21
26
  const dataset = collectDataset(this.$attrs)
22
27
  const id = this.$attrs.id || ''