@dcloudio/uni-mp-vue 3.0.0-alpha-3040420220402004 → 3.0.0-alpha-3040520220408001

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.
@@ -1413,6 +1413,14 @@ function queueFlush() {
1413
1413
  currentFlushPromise = resolvedPromise.then(flushJobs);
1414
1414
  }
1415
1415
  }
1416
+ function invalidateJob(job) {
1417
+ const i = queue.indexOf(job);
1418
+ if (i > flushIndex) {
1419
+ queue.splice(i, 1);
1420
+ }
1421
+ // fixed by xxxxxx
1422
+ return i;
1423
+ }
1416
1424
  function queueCb(cb, activeQueue, pendingQueue, index) {
1417
1425
  if (!isArray(cb)) {
1418
1426
  if (!activeQueue ||
@@ -1787,6 +1795,10 @@ function provide(key, value) {
1787
1795
  }
1788
1796
  // TS doesn't allow symbol as index type
1789
1797
  provides[key] = value;
1798
+ // 当实例为 App 时,同步到全局 provide
1799
+ if (currentInstance.type.mpType === 'app') {
1800
+ currentInstance.appContext.app.provide(key, value);
1801
+ }
1790
1802
  }
1791
1803
  }
1792
1804
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
@@ -4424,12 +4436,6 @@ function unwrapper(target) {
4424
4436
  }
4425
4437
  function defineAsyncComponent(source) {
4426
4438
  console.error('defineAsyncComponent is unsupported');
4427
- }
4428
- function invalidateJob(job) {
4429
- const i = queue.indexOf(job);
4430
- if (i > -1) {
4431
- queue.splice(i, 1);
4432
- }
4433
4439
  }
4434
4440
 
4435
4441
  // import deepCopy from './deepCopy'
@@ -5352,12 +5358,20 @@ function vOn(value, key) {
5352
5358
  }
5353
5359
  else {
5354
5360
  // add
5355
- mpInstance[name] = createInvoker(value, instance);
5361
+ mpInstance[name] = createInvoker(name, value, instance, mpInstance);
5356
5362
  }
5357
5363
  return name;
5358
5364
  }
5359
- function createInvoker(initialValue, instance) {
5365
+ const editorReady = 'eReady';
5366
+ function createInvoker(name, initialValue, instance, mpInstance) {
5360
5367
  const invoker = (e) => {
5368
+ const dataset = e.target && e.target.dataset;
5369
+ // TODO 临时解决 editor ready 事件可能错乱的问题 https://github.com/dcloudio/uni-app/issues/3406
5370
+ if (mpInstance && dataset && dataset[editorReady]) {
5371
+ if (invoker.id !== dataset[editorReady]) {
5372
+ return mpInstance[dataset[editorReady]](e);
5373
+ }
5374
+ }
5361
5375
  patchMPEvent(e);
5362
5376
  let args = [e];
5363
5377
  if (e.detail && e.detail.__args__) {
@@ -5366,12 +5380,7 @@ function createInvoker(initialValue, instance) {
5366
5380
  const eventValue = invoker.value;
5367
5381
  const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e, eventValue), instance, 5 /* NATIVE_EVENT_HANDLER */, args);
5368
5382
  // 冒泡事件触发时,启用延迟策略,避免同一批次的事件执行时机不正确,对性能可能有略微影响 https://github.com/dcloudio/uni-app/issues/3228
5369
- const eventTarget = e.target;
5370
- const eventSync = eventTarget
5371
- ? eventTarget.dataset
5372
- ? eventTarget.dataset.eventsync === 'true'
5373
- : false
5374
- : false;
5383
+ const eventSync = dataset && dataset.eventsync;
5375
5384
  if (bubbles.includes(e.type) && !eventSync) {
5376
5385
  setTimeout(invoke);
5377
5386
  }
@@ -5379,6 +5388,7 @@ function createInvoker(initialValue, instance) {
5379
5388
  return invoke();
5380
5389
  }
5381
5390
  };
5391
+ invoker.id = name;
5382
5392
  invoker.value = initialValue;
5383
5393
  return invoker;
5384
5394
  }
@@ -5527,6 +5537,10 @@ function withScopedSlot(fn, { name, path, vueId, }) {
5527
5537
  function createScopedSlotInvoker(instance) {
5528
5538
  const invoker = (slotName, args, index) => {
5529
5539
  const slot = invoker.slots[slotName];
5540
+ if (!slot) {
5541
+ // slot 可能不存在 https://github.com/dcloudio/uni-app/issues/3346
5542
+ return;
5543
+ }
5530
5544
  const hasIndex = typeof index !== 'undefined';
5531
5545
  index = index || 0;
5532
5546
  // 确保当前 slot 的上下文,类似 withCtx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-mp-vue",
3
- "version": "3.0.0-alpha-3040420220402004",
3
+ "version": "3.0.0-alpha-3040520220408001",
4
4
  "description": "@dcloudio/uni-mp-vue",
5
5
  "main": "dist/vue.runtime.esm.js",
6
6
  "module": "dist/vue.runtime.esm.js",
@@ -19,6 +19,6 @@
19
19
  },
20
20
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
21
21
  "devDependencies": {
22
- "@dcloudio/uni-mp-vue": "3.0.0-alpha-3040420220402004"
22
+ "@dcloudio/uni-mp-vue": "3.0.0-alpha-3040520220408001"
23
23
  }
24
24
  }