diff --git a/packages/uni-mp-alipay/dist/uni.mp.esm.js b/packages/uni-mp-alipay/dist/uni.mp.esm.js index 29e6a327c0f65410cf870a64b7d6efc77ce6fbe9..3f22d256170fd544f8f52ba6baf2f7387d085922 100644 --- a/packages/uni-mp-alipay/dist/uni.mp.esm.js +++ b/packages/uni-mp-alipay/dist/uni.mp.esm.js @@ -1,4 +1,5 @@ import { isPlainObject, isArray, extend, hyphenate, isObject, hasOwn, toNumber, capitalize, isFunction, NOOP, EMPTY_OBJ, camelize } from '@vue/shared'; +import { onUnmounted } from 'vue'; const encode = encodeURIComponent; function stringifyQuery(obj, encodeStr = encode) { @@ -391,6 +392,9 @@ function initBaseInstance(instance, options) { } function initComponentInstance(instance, options) { initBaseInstance(instance, options); + { + initScopedSlotsParams(instance); + } const ctx = instance.ctx; MP_METHODS.forEach((method) => { ctx[method] = function (...args) { @@ -440,6 +444,53 @@ function callHook(name, args) { } const hooks = this.$[name]; return hooks && invokeArrayFns(hooks, args); +} +const center = {}; +const parents = {}; +function initScopedSlotsParams(instance) { + const ctx = instance.ctx; + ctx.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + return has; + }; + ctx.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object; + } + else { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + }; + ctx.$setScopedSlotsParams = function (name, value) { + const vueIds = instance.attrs.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + onUnmounted(function () { + const propsData = instance.attrs; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + }, instance); } const PAGE_HOOKS = [ diff --git a/packages/uni-mp-baidu/dist/uni.mp.esm.js b/packages/uni-mp-baidu/dist/uni.mp.esm.js index 28c53ea2ebbe50e0fa76a182406df0fa6ae1e279..20a90cbce4d924830fb3331837879321022370eb 100644 --- a/packages/uni-mp-baidu/dist/uni.mp.esm.js +++ b/packages/uni-mp-baidu/dist/uni.mp.esm.js @@ -1,4 +1,5 @@ import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared'; +import { onUnmounted } from 'vue'; const encode = encodeURIComponent; function stringifyQuery(obj, encodeStr = encode) { @@ -419,6 +420,9 @@ function initBaseInstance(instance, options) { } function initComponentInstance(instance, options) { initBaseInstance(instance, options); + { + initScopedSlotsParams(instance); + } const ctx = instance.ctx; MP_METHODS.forEach((method) => { ctx[method] = function (...args) { @@ -465,6 +469,53 @@ function callHook(name, args) { } const hooks = this.$[name]; return hooks && invokeArrayFns(hooks, args); +} +const center = {}; +const parents = {}; +function initScopedSlotsParams(instance) { + const ctx = instance.ctx; + ctx.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + return has; + }; + ctx.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object; + } + else { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + }; + ctx.$setScopedSlotsParams = function (name, value) { + const vueIds = instance.attrs.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + onUnmounted(function () { + const propsData = instance.attrs; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + }, instance); } const PAGE_HOOKS = [ diff --git a/packages/uni-mp-kuaishou/dist/uni.mp.esm.js b/packages/uni-mp-kuaishou/dist/uni.mp.esm.js index ac16bd244bd821cd83e309df7d465fc218d42b06..b1d3f97766cce8a8ff66658f731a724f23621796 100644 --- a/packages/uni-mp-kuaishou/dist/uni.mp.esm.js +++ b/packages/uni-mp-kuaishou/dist/uni.mp.esm.js @@ -1,4 +1,5 @@ import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared'; +import { onUnmounted } from 'vue'; const encode = encodeURIComponent; function stringifyQuery(obj, encodeStr = encode) { @@ -419,6 +420,9 @@ function initBaseInstance(instance, options) { } function initComponentInstance(instance, options) { initBaseInstance(instance, options); + { + initScopedSlotsParams(instance); + } const ctx = instance.ctx; MP_METHODS.forEach((method) => { ctx[method] = function (...args) { @@ -465,6 +469,53 @@ function callHook(name, args) { } const hooks = this.$[name]; return hooks && invokeArrayFns(hooks, args); +} +const center = {}; +const parents = {}; +function initScopedSlotsParams(instance) { + const ctx = instance.ctx; + ctx.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + return has; + }; + ctx.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object; + } + else { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + }; + ctx.$setScopedSlotsParams = function (name, value) { + const vueIds = instance.attrs.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + onUnmounted(function () { + const propsData = instance.attrs; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + }, instance); } const PAGE_HOOKS = [ @@ -1179,7 +1230,7 @@ function fixSetDataStart(mpInstance) { mpInstance.__fixInitData = function () { this.setData = setData; const fn = () => { - setDataArgs.forEach(args => { + setDataArgs.forEach((args) => { setData.apply(this, args); }); }; @@ -1219,7 +1270,7 @@ function parse(componentOptions) { }; } var parseComponentOptions = extend({}, baseParseOptions, { - parse + parse, }); const createComponent = initCreateComponent(parseComponentOptions); diff --git a/packages/uni-mp-qq/dist/uni.mp.esm.js b/packages/uni-mp-qq/dist/uni.mp.esm.js index 2387513ad6165e9de5bd544775644afe569e3245..05f4361200c710eb0487391164e813defabf82e9 100644 --- a/packages/uni-mp-qq/dist/uni.mp.esm.js +++ b/packages/uni-mp-qq/dist/uni.mp.esm.js @@ -1,4 +1,5 @@ import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared'; +import { onUnmounted } from 'vue'; const encode = encodeURIComponent; function stringifyQuery(obj, encodeStr = encode) { @@ -419,6 +420,9 @@ function initBaseInstance(instance, options) { } function initComponentInstance(instance, options) { initBaseInstance(instance, options); + { + initScopedSlotsParams(instance); + } const ctx = instance.ctx; MP_METHODS.forEach((method) => { ctx[method] = function (...args) { @@ -465,6 +469,53 @@ function callHook(name, args) { } const hooks = this.$[name]; return hooks && invokeArrayFns(hooks, args); +} +const center = {}; +const parents = {}; +function initScopedSlotsParams(instance) { + const ctx = instance.ctx; + ctx.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + return has; + }; + ctx.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object; + } + else { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + }; + ctx.$setScopedSlotsParams = function (name, value) { + const vueIds = instance.attrs.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + onUnmounted(function () { + const propsData = instance.attrs; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + }, instance); } const PAGE_HOOKS = [ diff --git a/packages/uni-mp-toutiao/dist/uni.mp.esm.js b/packages/uni-mp-toutiao/dist/uni.mp.esm.js index 95f25dfa06778150505f56845b57c49d80c18057..fa129fc15188e0e50e3d40896a7c6fe4cb2d4a35 100644 --- a/packages/uni-mp-toutiao/dist/uni.mp.esm.js +++ b/packages/uni-mp-toutiao/dist/uni.mp.esm.js @@ -1,4 +1,5 @@ import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared'; +import { onUnmounted } from 'vue'; const encode = encodeURIComponent; function stringifyQuery(obj, encodeStr = encode) { @@ -419,6 +420,9 @@ function initBaseInstance(instance, options) { } function initComponentInstance(instance, options) { initBaseInstance(instance, options); + { + initScopedSlotsParams(instance); + } const ctx = instance.ctx; MP_METHODS.forEach((method) => { ctx[method] = function (...args) { @@ -465,6 +469,53 @@ function callHook(name, args) { } const hooks = this.$[name]; return hooks && invokeArrayFns(hooks, args); +} +const center = {}; +const parents = {}; +function initScopedSlotsParams(instance) { + const ctx = instance.ctx; + ctx.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + return has; + }; + ctx.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object; + } + else { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + }; + ctx.$setScopedSlotsParams = function (name, value) { + const vueIds = instance.attrs.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + onUnmounted(function () { + const propsData = instance.attrs; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + }, instance); } const PAGE_HOOKS = [ diff --git a/packages/uni-mp-weixin/dist/uni.mp.esm.js b/packages/uni-mp-weixin/dist/uni.mp.esm.js index e2744e4c44dfab82f7baef569dfe647a9f58185e..161e4e76862cdbf1f309394c56cc06736a668d9d 100644 --- a/packages/uni-mp-weixin/dist/uni.mp.esm.js +++ b/packages/uni-mp-weixin/dist/uni.mp.esm.js @@ -1,4 +1,5 @@ import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared'; +import { onUnmounted } from 'vue'; const encode = encodeURIComponent; function stringifyQuery(obj, encodeStr = encode) { @@ -365,6 +366,9 @@ function initBaseInstance(instance, options) { } function initComponentInstance(instance, options) { initBaseInstance(instance, options); + { + initScopedSlotsParams(instance); + } const ctx = instance.ctx; MP_METHODS.forEach((method) => { ctx[method] = function (...args) { @@ -411,6 +415,53 @@ function callHook(name, args) { } const hooks = this.$[name]; return hooks && invokeArrayFns(hooks, args); +} +const center = {}; +const parents = {}; +function initScopedSlotsParams(instance) { + const ctx = instance.ctx; + ctx.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + return has; + }; + ctx.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object; + } + else { + parents[vueId] = this; + onUnmounted(() => { + delete parents[vueId]; + }, instance); + } + }; + ctx.$setScopedSlotsParams = function (name, value) { + const vueIds = instance.attrs.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + onUnmounted(function () { + const propsData = instance.attrs; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + }, instance); } const PAGE_HOOKS = [