diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 2957912a3e8088cd2d4cb60f9da4fa08723efa85..f0ddab2dc2fa94328c714ca48d79219979919668 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -1304,7 +1336,9 @@ var en = { "uni.video.danmu": "Danmu", "uni.video.volume": "Volume", "uni.button.feedback.title": "feedback", - "uni.button.feedback.send": "send" + "uni.button.feedback.send": "send", + "uni.chooseLocation.search": "Find Place", + "uni.chooseLocation.cancel": "Cancel" }; var es = { @@ -1337,7 +1371,9 @@ var es = { "uni.video.danmu": "Danmu", "uni.video.volume": "Volumen", "uni.button.feedback.title": "realimentación", - "uni.button.feedback.send": "enviar" + "uni.button.feedback.send": "enviar", + "uni.chooseLocation.search": "Encontrar", + "uni.chooseLocation.cancel": "Cancelar" }; var fr = { @@ -1370,7 +1406,9 @@ var fr = { "uni.video.danmu": "Danmu", "uni.video.volume": "Le Volume", "uni.button.feedback.title": "retour d'information", - "uni.button.feedback.send": "envoyer" + "uni.button.feedback.send": "envoyer", + "uni.chooseLocation.search": "Trouve", + "uni.chooseLocation.cancel": "Annuler" }; var zhHans = { @@ -1403,7 +1441,9 @@ var zhHans = { "uni.video.danmu": "弹幕", "uni.video.volume": "音量", "uni.button.feedback.title": "问题反馈", - "uni.button.feedback.send": "发送" + "uni.button.feedback.send": "发送", + "uni.chooseLocation.search": "搜索地点", + "uni.chooseLocation.cancel": "取消" }; var zhHant = { @@ -1436,7 +1476,9 @@ var zhHant = { "uni.video.danmu": "彈幕", "uni.video.volume": "音量", "uni.button.feedback.title": "問題反饋", - "uni.button.feedback.send": "發送" + "uni.button.feedback.send": "發送", + "uni.chooseLocation.search": "搜索地點", + "uni.chooseLocation.cancel": "取消" }; const messages = { @@ -1452,12 +1494,17 @@ let locale; { if (typeof weex === 'object') { locale = weex.requireModule('plus').getLanguage(); + } else { + locale = ''; } } -const i18n = initVueI18n(locale, messages ); +const i18n = initVueI18n( + locale, + messages +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -1471,7 +1518,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -1480,7 +1527,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -1575,112 +1622,112 @@ function getEventChannel (id) { return eventChannelStack.shift() } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel () { - Vue.prototype.getOpenerEventChannel = function () { - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel(); - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "app-plus"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +function initEventChannel () { + Vue.prototype.getOpenerEventChannel = function () { + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); + } + return this.__eventChannel__ + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel(); + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "app-plus"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; diff --git a/packages/uni-i18n/dist/uni-i18n.cjs.js b/packages/uni-i18n/dist/uni-i18n.cjs.js index 5e7e69eff833211662038cbb3a0f942dce6dd2d7..2d54ad22a5db725cca72ef5916e4a4fea621e74b 100644 --- a/packages/uni-i18n/dist/uni-i18n.cjs.js +++ b/packages/uni-i18n/dist/uni-i18n.cjs.js @@ -126,10 +126,10 @@ function normalizeLocale(locale, messages) { } locale = locale.toLowerCase(); if (locale.indexOf('zh') === 0) { - if (locale.indexOf('-hans') !== -1) { + if (locale.indexOf('-hans') > -1) { return LOCALE_ZH_HANS; } - if (locale.indexOf('-hant') !== -1) { + if (locale.indexOf('-hant') > -1) { return LOCALE_ZH_HANT; } if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) { @@ -221,11 +221,29 @@ class I18n { } } -const ignoreVueI18n = true; function watchAppLocale(appVm, i18n) { - appVm.$watch(() => appVm.$locale, (newLocale) => { - i18n.setLocale(newLocale); - }); + // 需要保证 watch 的触发在组件渲染之前 + if (appVm.$watchLocale) { + // vue2 + appVm.$watchLocale((newLocale) => { + i18n.setLocale(newLocale); + }); + } + else { + appVm.$watch(() => appVm.$locale, (newLocale) => { + i18n.setLocale(newLocale); + }); + } +} +function getDefaultLocale() { + if (typeof uni !== 'undefined' && uni.getLocale) { + return uni.getLocale(); + } + // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale + if (typeof global !== 'undefined' && global.getLocale) { + return global.getLocale(); + } + return LOCALE_EN; } function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { // 兼容旧版本入参 @@ -236,9 +254,8 @@ function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { ]; } if (typeof locale !== 'string') { - locale = - (typeof uni !== 'undefined' && uni.getLocale && uni.getLocale()) || - LOCALE_EN; + // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined + locale = getDefaultLocale(); } if (typeof fallbackLocale !== 'string') { fallbackLocale = @@ -260,33 +277,32 @@ function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { }; } else { - const appVm = getApp().$vm; - watchAppLocale(appVm, i18n); - if (!appVm.$t || !appVm.$i18n || ignoreVueI18n) { - // if (!locale) { - // i18n.setLocale(getDefaultLocale()) - // } - /* eslint-disable no-func-assign */ - t = function (key, values) { + let isWatchedAppLocale = false; + t = function (key, values) { + const appVm = getApp().$vm; + // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化 + // options: { + // type: Array, + // default () { + // return [{ + // icon: 'shop', + // text: t("uni-goods-nav.options.shop"), + // }, { + // icon: 'cart', + // text: t("uni-goods-nav.options.cart") + // }] + // } + // }, + if (appVm) { // 触发响应式 appVm.$locale; - return i18n.t(key, values); - }; - } - else { - /* eslint-disable no-func-assign */ - t = function (key, values) { - const $i18n = appVm.$i18n; - const silentTranslationWarn = $i18n.silentTranslationWarn; - $i18n.silentTranslationWarn = true; - const msg = appVm.$t(key, values); - $i18n.silentTranslationWarn = silentTranslationWarn; - if (msg !== key) { - return msg; + if (!isWatchedAppLocale) { + isWatchedAppLocale = true; + watchAppLocale(appVm, i18n); } - return i18n.t(key, $i18n.locale, values); - }; - } + } + return i18n.t(key, values); + }; } return t(key, values); }; @@ -420,6 +436,25 @@ function walkJsonObj(jsonObj, walk) { return false; } +function resolveLocale(locales) { + return (locale) => { + if (!locale) { + return locale; + } + locale = normalizeLocale(locale) || locale; + return resolveLocaleChain(locale).find((locale) => locales.indexOf(locale) > -1); + }; +} +function resolveLocaleChain(locale) { + const chain = []; + const tokens = locale.split('-'); + while (tokens.length) { + chain.push(tokens.join('-')); + tokens.pop(); + } + return chain; +} + exports.Formatter = BaseFormatter; exports.I18n = I18n; exports.LOCALE_EN = LOCALE_EN; @@ -434,3 +469,4 @@ exports.isI18nStr = isI18nStr; exports.isString = isString; exports.normalizeLocale = normalizeLocale; exports.parseI18nJson = parseI18nJson; +exports.resolveLocale = resolveLocale; diff --git a/packages/uni-i18n/dist/uni-i18n.d.ts b/packages/uni-i18n/dist/uni-i18n.d.ts index 85c675ab66acb230bcbe5ce71de840c7921a2780..8640c34d1b8cfe94ee5b91bf0b17ec0006dcf549 100644 --- a/packages/uni-i18n/dist/uni-i18n.d.ts +++ b/packages/uni-i18n/dist/uni-i18n.d.ts @@ -59,6 +59,8 @@ export declare function isI18nStr(value: string, delimiters: [string, string]): export declare const isString: (val: unknown) => val is string; +declare type Locale = string; + export declare const LOCALE_EN = "en"; export declare const LOCALE_ES = "es"; @@ -77,6 +79,8 @@ export declare function normalizeLocale(locale: string, messages?: LocaleMessage export declare function parseI18nJson(jsonObj: unknown, values: Record, delimiters: [string, string]): unknown; +export declare function resolveLocale(locales: Locale[]): (locale: Locale) => string | undefined; + declare type Token = { type: 'text' | 'named' | 'list' | 'unknown'; value: string; diff --git a/packages/uni-i18n/dist/uni-i18n.es.js b/packages/uni-i18n/dist/uni-i18n.es.js index d4d1d6331893ba7849f54fc18d7afb11fadd6b68..b7c0729e3f134669604d29806f13d2d7ab2c0dcf 100644 --- a/packages/uni-i18n/dist/uni-i18n.es.js +++ b/packages/uni-i18n/dist/uni-i18n.es.js @@ -122,10 +122,10 @@ function normalizeLocale(locale, messages) { } locale = locale.toLowerCase(); if (locale.indexOf('zh') === 0) { - if (locale.indexOf('-hans') !== -1) { + if (locale.indexOf('-hans') > -1) { return LOCALE_ZH_HANS; } - if (locale.indexOf('-hant') !== -1) { + if (locale.indexOf('-hant') > -1) { return LOCALE_ZH_HANT; } if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) { @@ -217,11 +217,29 @@ class I18n { } } -const ignoreVueI18n = true; function watchAppLocale(appVm, i18n) { - appVm.$watch(() => appVm.$locale, (newLocale) => { - i18n.setLocale(newLocale); - }); + // 需要保证 watch 的触发在组件渲染之前 + if (appVm.$watchLocale) { + // vue2 + appVm.$watchLocale((newLocale) => { + i18n.setLocale(newLocale); + }); + } + else { + appVm.$watch(() => appVm.$locale, (newLocale) => { + i18n.setLocale(newLocale); + }); + } +} +function getDefaultLocale() { + if (typeof uni !== 'undefined' && uni.getLocale) { + return uni.getLocale(); + } + // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale + if (typeof global !== 'undefined' && global.getLocale) { + return global.getLocale(); + } + return LOCALE_EN; } function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { // 兼容旧版本入参 @@ -232,9 +250,8 @@ function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { ]; } if (typeof locale !== 'string') { - locale = - (typeof uni !== 'undefined' && uni.getLocale && uni.getLocale()) || - LOCALE_EN; + // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined + locale = getDefaultLocale(); } if (typeof fallbackLocale !== 'string') { fallbackLocale = @@ -256,33 +273,32 @@ function initVueI18n(locale, messages = {}, fallbackLocale, watcher) { }; } else { - const appVm = getApp().$vm; - watchAppLocale(appVm, i18n); - if (!appVm.$t || !appVm.$i18n || ignoreVueI18n) { - // if (!locale) { - // i18n.setLocale(getDefaultLocale()) - // } - /* eslint-disable no-func-assign */ - t = function (key, values) { + let isWatchedAppLocale = false; + t = function (key, values) { + const appVm = getApp().$vm; + // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化 + // options: { + // type: Array, + // default () { + // return [{ + // icon: 'shop', + // text: t("uni-goods-nav.options.shop"), + // }, { + // icon: 'cart', + // text: t("uni-goods-nav.options.cart") + // }] + // } + // }, + if (appVm) { // 触发响应式 appVm.$locale; - return i18n.t(key, values); - }; - } - else { - /* eslint-disable no-func-assign */ - t = function (key, values) { - const $i18n = appVm.$i18n; - const silentTranslationWarn = $i18n.silentTranslationWarn; - $i18n.silentTranslationWarn = true; - const msg = appVm.$t(key, values); - $i18n.silentTranslationWarn = silentTranslationWarn; - if (msg !== key) { - return msg; + if (!isWatchedAppLocale) { + isWatchedAppLocale = true; + watchAppLocale(appVm, i18n); } - return i18n.t(key, $i18n.locale, values); - }; - } + } + return i18n.t(key, values); + }; } return t(key, values); }; @@ -416,4 +432,23 @@ function walkJsonObj(jsonObj, walk) { return false; } -export { BaseFormatter as Formatter, I18n, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT, compileI18nJsonStr, hasI18nJson, initVueI18n, isI18nStr, isString, normalizeLocale, parseI18nJson }; +function resolveLocale(locales) { + return (locale) => { + if (!locale) { + return locale; + } + locale = normalizeLocale(locale) || locale; + return resolveLocaleChain(locale).find((locale) => locales.indexOf(locale) > -1); + }; +} +function resolveLocaleChain(locale) { + const chain = []; + const tokens = locale.split('-'); + while (tokens.length) { + chain.push(tokens.join('-')); + tokens.pop(); + } + return chain; +} + +export { BaseFormatter as Formatter, I18n, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT, compileI18nJsonStr, hasI18nJson, initVueI18n, isI18nStr, isString, normalizeLocale, parseI18nJson, resolveLocale }; diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 52fdc09a5ef6da500ebfa8cf0036269dd53d5ede..2414a75d6cee398b384a33373eb7814c2824cebc 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -2025,9 +2057,12 @@ let locale; locale = my.getSystemInfoSync().language; } -const i18n = initVueI18n(locale, {}); +const i18n = initVueI18n( + locale, + {} +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -2041,7 +2076,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -2050,7 +2085,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -2064,167 +2099,171 @@ function initAppLocale (Vue, appVm, locale) { }); } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel$1 () { - Vue.prototype.getOpenerEventChannel = function () { - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function initScopedSlotsParams () { - const center = {}; - const parents = {}; - - Vue.prototype.$hasScopedSlotsParams = function (vueId) { - const has = center[vueId]; - if (!has) { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - return has - }; - - Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { - const data = center[vueId]; - if (data) { - const object = data[name] || {}; - return key ? object[key] : object - } else { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - }; - - Vue.prototype.$setScopedSlotsParams = function (name, value) { - const vueIds = this.$options.propsData.vueId; - if (vueIds) { - const vueId = vueIds.split(',')[0]; - const object = center[vueId] = center[vueId] || {}; - object[name] = value; - if (parents[vueId]) { - parents[vueId].$forceUpdate(); - } - } - }; - - Vue.mixin({ - destroyed () { - const propsData = this.$options.propsData; - const vueId = propsData && propsData.vueId; - if (vueId) { - delete center[vueId]; - delete parents[vueId]; - } - } - }); -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel$1(); - { - initScopedSlotsParams(); - } - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "mp-alipay"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, my.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +{ + hooks.push('onShareAppMessage'); +} + +function initEventChannel$1 () { + Vue.prototype.getOpenerEventChannel = function () { + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); + } + return this.__eventChannel__ + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function initScopedSlotsParams () { + const center = {}; + const parents = {}; + + Vue.prototype.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + return has + }; + + Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object + } else { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + }; + + Vue.prototype.$setScopedSlotsParams = function (name, value) { + const vueIds = this.$options.propsData.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + + Vue.mixin({ + destroyed () { + const propsData = this.$options.propsData; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + } + }); +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel$1(); + { + initScopedSlotsParams(); + } + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "mp-alipay"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, my.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } function findVmByVueId (vm, vuePid) { diff --git a/packages/uni-mp-alipay/dist/uni.api.esm.js b/packages/uni-mp-alipay/dist/uni.api.esm.js index 384669b0224639d7ec1fd99483fef1cacb5dc54b..7054e102b9b34ca84c650a926380be7443a42915 100644 --- a/packages/uni-mp-alipay/dist/uni.api.esm.js +++ b/packages/uni-mp-alipay/dist/uni.api.esm.js @@ -473,7 +473,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce else if (isPlainObject(method)) { removeInterceptorHook(globalInterceptors, method); } -}, RemoveInterceptorProtocol); +}, RemoveInterceptorProtocol); +const interceptors = {}; const API_ON = '$on'; const OnProtocol = [ @@ -753,7 +754,10 @@ const onLocaleChange = (fn) => { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } -}; +}; +if (typeof global !== 'undefined') { + global.getLocale = getLocale; +} const baseApis = { $on, @@ -761,6 +765,7 @@ const baseApis = { $once, $emit, upx2px, + interceptors, addInterceptor, removeInterceptor, onAppLaunch, diff --git a/packages/uni-mp-alipay/dist/uni.mp.esm.js b/packages/uni-mp-alipay/dist/uni.mp.esm.js index 93b8781bc5c7c0daa6060a2ae918a4729603d111..0f3d45111eee33626d3a81bf629c7d2274fc8d66 100644 --- a/packages/uni-mp-alipay/dist/uni.mp.esm.js +++ b/packages/uni-mp-alipay/dist/uni.mp.esm.js @@ -55,6 +55,7 @@ const ON_TAB_ITEM_TAP = 'onTabItemTap'; const ON_REACH_BOTTOM = 'onReachBottom'; const ON_PULL_DOWN_REFRESH = 'onPullDownRefresh'; const ON_ADD_TO_FAVORITES = 'onAddToFavorites'; +const ON_SHARE_APP_MESSAGE = 'onShareAppMessage'; class EventChannel { constructor(id, events) { @@ -557,6 +558,9 @@ const HOOKS = [ ON_PAGE_NOT_FOUND, ON_UNHANDLE_REJECTION, ]; +{ + HOOKS.push(ON_SHARE_APP_MESSAGE); +} function parseApp(instance, parseAppOptions) { const internalInstance = instance.$; const appOptions = { diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index ce5233d63057a916a8194da84d9a9bcba8e9bf37..4f187495dceca8a60b92f06a68a58937d194b7f9 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -1703,9 +1735,12 @@ let locale; locale = swan.getSystemInfoSync().language; } -const i18n = initVueI18n(locale, {}); +const i18n = initVueI18n( + locale, + {} +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -1719,7 +1754,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -1728,7 +1763,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -1742,167 +1777,167 @@ function initAppLocale (Vue, appVm, locale) { }); } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel$1 () { - Vue.prototype.getOpenerEventChannel = function () { - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function initScopedSlotsParams () { - const center = {}; - const parents = {}; - - Vue.prototype.$hasScopedSlotsParams = function (vueId) { - const has = center[vueId]; - if (!has) { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - return has - }; - - Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { - const data = center[vueId]; - if (data) { - const object = data[name] || {}; - return key ? object[key] : object - } else { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - }; - - Vue.prototype.$setScopedSlotsParams = function (name, value) { - const vueIds = this.$options.propsData.vueId; - if (vueIds) { - const vueId = vueIds.split(',')[0]; - const object = center[vueId] = center[vueId] || {}; - object[name] = value; - if (parents[vueId]) { - parents[vueId].$forceUpdate(); - } - } - }; - - Vue.mixin({ - destroyed () { - const propsData = this.$options.propsData; - const vueId = propsData && propsData.vueId; - if (vueId) { - delete center[vueId]; - delete parents[vueId]; - } - } - }); -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel$1(); - { - initScopedSlotsParams(); - } - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "mp-baidu"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, swan.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +function initEventChannel$1 () { + Vue.prototype.getOpenerEventChannel = function () { + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); + } + return this.__eventChannel__ + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function initScopedSlotsParams () { + const center = {}; + const parents = {}; + + Vue.prototype.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + return has + }; + + Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object + } else { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + }; + + Vue.prototype.$setScopedSlotsParams = function (name, value) { + const vueIds = this.$options.propsData.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + + Vue.mixin({ + destroyed () { + const propsData = this.$options.propsData; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + } + }); +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel$1(); + { + initScopedSlotsParams(); + } + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "mp-baidu"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, swan.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } function findVmByVueId (vm, vuePid) { diff --git a/packages/uni-mp-baidu/dist/uni.api.esm.js b/packages/uni-mp-baidu/dist/uni.api.esm.js index 00e9998b285302c27c53af590198df2685a0ac0d..28c2a2bd1a2a4604b0d0ffc8a455497170bfbbee 100644 --- a/packages/uni-mp-baidu/dist/uni.api.esm.js +++ b/packages/uni-mp-baidu/dist/uni.api.esm.js @@ -473,7 +473,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce else if (isPlainObject(method)) { removeInterceptorHook(globalInterceptors, method); } -}, RemoveInterceptorProtocol); +}, RemoveInterceptorProtocol); +const interceptors = {}; const API_ON = '$on'; const OnProtocol = [ @@ -753,7 +754,10 @@ const onLocaleChange = (fn) => { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } -}; +}; +if (typeof global !== 'undefined') { + global.getLocale = getLocale; +} const baseApis = { $on, @@ -761,6 +765,7 @@ const baseApis = { $once, $emit, upx2px, + interceptors, addInterceptor, removeInterceptor, onAppLaunch, diff --git a/packages/uni-mp-kuaishou/dist/index.js b/packages/uni-mp-kuaishou/dist/index.js index 04c7b5661a1efb973a28e750d29717c53db900de..a5c6e2209dde68dbadae661614d3adccef5fab4f 100644 --- a/packages/uni-mp-kuaishou/dist/index.js +++ b/packages/uni-mp-kuaishou/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -1452,9 +1484,12 @@ let locale; locale = ks.getSystemInfoSync().language; } -const i18n = initVueI18n(locale, {}); +const i18n = initVueI18n( + locale, + {} +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -1468,7 +1503,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -1477,7 +1512,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -1491,167 +1526,167 @@ function initAppLocale (Vue, appVm, locale) { }); } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel$1 () { - Vue.prototype.getOpenerEventChannel = function () { - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function initScopedSlotsParams () { - const center = {}; - const parents = {}; - - Vue.prototype.$hasScopedSlotsParams = function (vueId) { - const has = center[vueId]; - if (!has) { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - return has - }; - - Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { - const data = center[vueId]; - if (data) { - const object = data[name] || {}; - return key ? object[key] : object - } else { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - }; - - Vue.prototype.$setScopedSlotsParams = function (name, value) { - const vueIds = this.$options.propsData.vueId; - if (vueIds) { - const vueId = vueIds.split(',')[0]; - const object = center[vueId] = center[vueId] || {}; - object[name] = value; - if (parents[vueId]) { - parents[vueId].$forceUpdate(); - } - } - }; - - Vue.mixin({ - destroyed () { - const propsData = this.$options.propsData; - const vueId = propsData && propsData.vueId; - if (vueId) { - delete center[vueId]; - delete parents[vueId]; - } - } - }); -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel$1(); - { - initScopedSlotsParams(); - } - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "mp-kuaishou"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, ks.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +function initEventChannel$1 () { + Vue.prototype.getOpenerEventChannel = function () { + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); + } + return this.__eventChannel__ + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function initScopedSlotsParams () { + const center = {}; + const parents = {}; + + Vue.prototype.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + return has + }; + + Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object + } else { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + }; + + Vue.prototype.$setScopedSlotsParams = function (name, value) { + const vueIds = this.$options.propsData.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + + Vue.mixin({ + destroyed () { + const propsData = this.$options.propsData; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + } + }); +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel$1(); + { + initScopedSlotsParams(); + } + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "mp-kuaishou"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, ks.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; diff --git a/packages/uni-mp-kuaishou/dist/uni.api.esm.js b/packages/uni-mp-kuaishou/dist/uni.api.esm.js index 9f4c385572320aacbcd1d968fe2f2fe6c5f58125..2f30d2ed6365f61bfc76251f85247eae3d96e937 100644 --- a/packages/uni-mp-kuaishou/dist/uni.api.esm.js +++ b/packages/uni-mp-kuaishou/dist/uni.api.esm.js @@ -473,7 +473,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce else if (isPlainObject(method)) { removeInterceptorHook(globalInterceptors, method); } -}, RemoveInterceptorProtocol); +}, RemoveInterceptorProtocol); +const interceptors = {}; const API_ON = '$on'; const OnProtocol = [ @@ -753,7 +754,10 @@ const onLocaleChange = (fn) => { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } -}; +}; +if (typeof global !== 'undefined') { + global.getLocale = getLocale; +} const baseApis = { $on, @@ -761,6 +765,7 @@ const baseApis = { $once, $emit, upx2px, + interceptors, addInterceptor, removeInterceptor, onAppLaunch, diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 4640ac6a747a565de611805f00889972a9c77aa5..c5a4b93c38fd10f1e6e2b2e9bddec18647cf8f52 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -1613,9 +1645,12 @@ let locale; locale = wx.getSystemInfoSync().language; } -const i18n = initVueI18n(locale, {}); +const i18n = initVueI18n( + locale, + {} +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -1629,7 +1664,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -1638,7 +1673,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -1652,172 +1687,172 @@ function initAppLocale (Vue, appVm, locale) { }); } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel$1 () { - Vue.prototype.getOpenerEventChannel = function () { - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function initScopedSlotsParams () { - const center = {}; - const parents = {}; - - Vue.prototype.$hasScopedSlotsParams = function (vueId) { - const has = center[vueId]; - if (!has) { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - return has - }; - - Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { - const data = center[vueId]; - if (data) { - const object = data[name] || {}; - return key ? object[key] : object - } else { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - }; - - Vue.prototype.$setScopedSlotsParams = function (name, value) { - const vueIds = this.$options.propsData.vueId; - if (vueIds) { - const vueId = vueIds.split(',')[0]; - const object = center[vueId] = center[vueId] || {}; - object[name] = value; - if (parents[vueId]) { - parents[vueId].$forceUpdate(); - } - } - }; - - Vue.mixin({ - destroyed () { - const propsData = this.$options.propsData; - const vueId = propsData && propsData.vueId; - if (vueId) { - delete center[vueId]; - delete parents[vueId]; - } - } - }); -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel$1(); - { - initScopedSlotsParams(); - } - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "mp-qq"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - { - if (wx.canIUse && !wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断 - console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上'); - } - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +function initEventChannel$1 () { + Vue.prototype.getOpenerEventChannel = function () { + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); + } + return this.__eventChannel__ + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function initScopedSlotsParams () { + const center = {}; + const parents = {}; + + Vue.prototype.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + return has + }; + + Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object + } else { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + }; + + Vue.prototype.$setScopedSlotsParams = function (name, value) { + const vueIds = this.$options.propsData.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + + Vue.mixin({ + destroyed () { + const propsData = this.$options.propsData; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + } + }); +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel$1(); + { + initScopedSlotsParams(); + } + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "mp-qq"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + { + if (wx.canIUse && !wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断 + console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上'); + } + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; diff --git a/packages/uni-mp-qq/dist/uni.api.esm.js b/packages/uni-mp-qq/dist/uni.api.esm.js index 08206a251c95151ea28186b3517872fdb024d78a..60abc08d2bfbba705cdfd2e145aad8affb1389c1 100644 --- a/packages/uni-mp-qq/dist/uni.api.esm.js +++ b/packages/uni-mp-qq/dist/uni.api.esm.js @@ -473,7 +473,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce else if (isPlainObject(method)) { removeInterceptorHook(globalInterceptors, method); } -}, RemoveInterceptorProtocol); +}, RemoveInterceptorProtocol); +const interceptors = {}; const API_ON = '$on'; const OnProtocol = [ @@ -753,7 +754,10 @@ const onLocaleChange = (fn) => { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } -}; +}; +if (typeof global !== 'undefined') { + global.getLocale = getLocale; +} const baseApis = { $on, @@ -761,6 +765,7 @@ const baseApis = { $once, $emit, upx2px, + interceptors, addInterceptor, removeInterceptor, onAppLaunch, diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 8557b36054302fdd87912fb7b42c719d973e92a8..994992acc827d7128906f4fa22738742e0592fca 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -1709,9 +1741,12 @@ let locale; locale = tt.getSystemInfoSync().language; } -const i18n = initVueI18n(locale, {}); +const i18n = initVueI18n( + locale, + {} +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -1725,7 +1760,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -1734,7 +1769,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -1748,167 +1783,167 @@ function initAppLocale (Vue, appVm, locale) { }); } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel$1 () { - Vue.prototype.getOpenerEventChannel = function () { - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function initScopedSlotsParams () { - const center = {}; - const parents = {}; - - Vue.prototype.$hasScopedSlotsParams = function (vueId) { - const has = center[vueId]; - if (!has) { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - return has - }; - - Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { - const data = center[vueId]; - if (data) { - const object = data[name] || {}; - return key ? object[key] : object - } else { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - }; - - Vue.prototype.$setScopedSlotsParams = function (name, value) { - const vueIds = this.$options.propsData.vueId; - if (vueIds) { - const vueId = vueIds.split(',')[0]; - const object = center[vueId] = center[vueId] || {}; - object[name] = value; - if (parents[vueId]) { - parents[vueId].$forceUpdate(); - } - } - }; - - Vue.mixin({ - destroyed () { - const propsData = this.$options.propsData; - const vueId = propsData && propsData.vueId; - if (vueId) { - delete center[vueId]; - delete parents[vueId]; - } - } - }); -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel$1(); - { - initScopedSlotsParams(); - } - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "mp-toutiao"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, tt.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +function initEventChannel$1 () { + Vue.prototype.getOpenerEventChannel = function () { + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); + } + return this.__eventChannel__ + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function initScopedSlotsParams () { + const center = {}; + const parents = {}; + + Vue.prototype.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + return has + }; + + Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object + } else { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + }; + + Vue.prototype.$setScopedSlotsParams = function (name, value) { + const vueIds = this.$options.propsData.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + + Vue.mixin({ + destroyed () { + const propsData = this.$options.propsData; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + } + }); +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel$1(); + { + initScopedSlotsParams(); + } + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "mp-toutiao"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, tt.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } function findVmByVueId (vm, vuePid) { diff --git a/packages/uni-mp-toutiao/dist/uni.api.esm.js b/packages/uni-mp-toutiao/dist/uni.api.esm.js index 4959c6fba7e00814688b663cbd453ceecd34102a..fc5cc7723cee582c3efa037a2dbd03019c5e1b7d 100644 --- a/packages/uni-mp-toutiao/dist/uni.api.esm.js +++ b/packages/uni-mp-toutiao/dist/uni.api.esm.js @@ -473,7 +473,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce else if (isPlainObject(method)) { removeInterceptorHook(globalInterceptors, method); } -}, RemoveInterceptorProtocol); +}, RemoveInterceptorProtocol); +const interceptors = {}; const API_ON = '$on'; const OnProtocol = [ @@ -753,7 +754,10 @@ const onLocaleChange = (fn) => { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } -}; +}; +if (typeof global !== 'undefined') { + global.getLocale = getLocale; +} const baseApis = { $on, @@ -761,6 +765,7 @@ const baseApis = { $once, $emit, upx2px, + interceptors, addInterceptor, removeInterceptor, onAppLaunch, diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 97508b6c74b31b2c0ca0834ed3b9486ee7afd6a5..20eadea4c9efa768d1b6c64667bb90bf92cea41d 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1,8 +1,36 @@ import Vue from 'vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; +let realAtob; + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function (str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)); + var bitmap; var result = ''; var r1; var r2; var i = 0; + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | + (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) + : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) + : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + return result + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + function b64DecodeUnicode (str) { - return decodeURIComponent(atob(str).split('').map(function (c) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) }).join('')) } @@ -431,6 +459,10 @@ function onLocaleChange (fn) { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } +} + +if (typeof global !== 'undefined') { + global.getLocale = getLocale; } const interceptors = { @@ -1349,9 +1381,12 @@ let locale; locale = wx.getSystemInfoSync().language; } -const i18n = initVueI18n(locale, {}); +const i18n = initVueI18n( + locale, + {} +); const t = i18n.t; -const i18nMixin = i18n.mixin = { +const i18nMixin = (i18n.mixin = { beforeCreate () { const unwatch = i18n.i18n.watchLocale(() => { this.$forceUpdate(); @@ -1365,7 +1400,7 @@ const i18nMixin = i18n.mixin = { return t(key, values) } } -}; +}); const setLocale$1 = i18n.setLocale; const getLocale$1 = i18n.getLocale; @@ -1374,7 +1409,7 @@ function initAppLocale (Vue, appVm, locale) { locale: locale || i18n.getLocale() }); const localeWatchers = []; - appVm.$watchLocale = (fn) => { + appVm.$watchLocale = fn => { localeWatchers.push(fn); }; Object.defineProperty(appVm, '$locale', { @@ -1401,172 +1436,172 @@ function getEventChannel (id) { return eventChannelStack.shift() } -const hooks = [ - 'onShow', - 'onHide', - 'onError', - 'onPageNotFound', - 'onThemeChange', - 'onUnhandledRejection' -]; - -function initEventChannel () { - Vue.prototype.getOpenerEventChannel = function () { - // 微信小程序使用自身getOpenerEventChannel - { - return this.$scope.getOpenerEventChannel() - } - }; - const callHook = Vue.prototype.__call_hook; - Vue.prototype.__call_hook = function (hook, args) { - if (hook === 'onLoad' && args && args.__id__) { - this.__eventChannel__ = getEventChannel(args.__id__); - delete args.__id__; - } - return callHook.call(this, hook, args) - }; -} - -function initScopedSlotsParams () { - const center = {}; - const parents = {}; - - Vue.prototype.$hasScopedSlotsParams = function (vueId) { - const has = center[vueId]; - if (!has) { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - return has - }; - - Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { - const data = center[vueId]; - if (data) { - const object = data[name] || {}; - return key ? object[key] : object - } else { - parents[vueId] = this; - this.$on('hook:destory', () => { - delete parents[vueId]; - }); - } - }; - - Vue.prototype.$setScopedSlotsParams = function (name, value) { - const vueIds = this.$options.propsData.vueId; - if (vueIds) { - const vueId = vueIds.split(',')[0]; - const object = center[vueId] = center[vueId] || {}; - object[name] = value; - if (parents[vueId]) { - parents[vueId].$forceUpdate(); - } - } - }; - - Vue.mixin({ - destroyed () { - const propsData = this.$options.propsData; - const vueId = propsData && propsData.vueId; - if (vueId) { - delete center[vueId]; - delete parents[vueId]; - } - } - }); -} - -function parseBaseApp (vm, { - mocks, - initRefs -}) { - initEventChannel(); - { - initScopedSlotsParams(); - } - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } - uniIdMixin(Vue); - - Vue.prototype.mpHost = "mp-weixin"; - - Vue.mixin({ - beforeCreate () { - if (!this.$options.mpType) { - return - } - - this.mpType = this.$options.mpType; - - this.$mp = { - data: {}, - [this.mpType]: this.$options.mpInstance - }; - - this.$scope = this.$options.mpInstance; - - delete this.$options.mpType; - delete this.$options.mpInstance; - if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n - const app = getApp(); - if (app.$vm && app.$vm.$i18n) { - this._i18n = app.$vm.$i18n; - } - } - if (this.mpType !== 'app') { - initRefs(this); - initMocks(this, mocks); - } - } - }); - - const appOptions = { - onLaunch (args) { - if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 - return - } - { - if (wx.canIUse && !wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断 - console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上'); - } - } - - this.$vm = vm; - - this.$vm.$mp = { - app: this - }; - - this.$vm.$scope = this; - // vm 上也挂载 globalData - this.$vm.globalData = this.globalData; - - this.$vm._isMounted = true; - this.$vm.__call_hook('mounted', args); - - this.$vm.__call_hook('onLaunch', args); - } - }; - - // 兼容旧版本 globalData - appOptions.globalData = vm.$options.globalData || {}; - // 将 methods 中的方法挂在 getApp() 中 - const methods = vm.$options.methods; - if (methods) { - Object.keys(methods).forEach(name => { - appOptions[name] = methods[name]; - }); - } - - initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans'); - - initHooks(appOptions, hooks); - - return appOptions +const hooks = [ + 'onShow', + 'onHide', + 'onError', + 'onPageNotFound', + 'onThemeChange', + 'onUnhandledRejection' +]; + +function initEventChannel () { + Vue.prototype.getOpenerEventChannel = function () { + // 微信小程序使用自身getOpenerEventChannel + { + return this.$scope.getOpenerEventChannel() + } + }; + const callHook = Vue.prototype.__call_hook; + Vue.prototype.__call_hook = function (hook, args) { + if (hook === 'onLoad' && args && args.__id__) { + this.__eventChannel__ = getEventChannel(args.__id__); + delete args.__id__; + } + return callHook.call(this, hook, args) + }; +} + +function initScopedSlotsParams () { + const center = {}; + const parents = {}; + + Vue.prototype.$hasScopedSlotsParams = function (vueId) { + const has = center[vueId]; + if (!has) { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + return has + }; + + Vue.prototype.$getScopedSlotsParams = function (vueId, name, key) { + const data = center[vueId]; + if (data) { + const object = data[name] || {}; + return key ? object[key] : object + } else { + parents[vueId] = this; + this.$on('hook:destory', () => { + delete parents[vueId]; + }); + } + }; + + Vue.prototype.$setScopedSlotsParams = function (name, value) { + const vueIds = this.$options.propsData.vueId; + if (vueIds) { + const vueId = vueIds.split(',')[0]; + const object = center[vueId] = center[vueId] || {}; + object[name] = value; + if (parents[vueId]) { + parents[vueId].$forceUpdate(); + } + } + }; + + Vue.mixin({ + destroyed () { + const propsData = this.$options.propsData; + const vueId = propsData && propsData.vueId; + if (vueId) { + delete center[vueId]; + delete parents[vueId]; + } + } + }); +} + +function parseBaseApp (vm, { + mocks, + initRefs +}) { + initEventChannel(); + { + initScopedSlotsParams(); + } + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + uniIdMixin(Vue); + + Vue.prototype.mpHost = "mp-weixin"; + + Vue.mixin({ + beforeCreate () { + if (!this.$options.mpType) { + return + } + + this.mpType = this.$options.mpType; + + this.$mp = { + data: {}, + [this.mpType]: this.$options.mpInstance + }; + + this.$scope = this.$options.mpInstance; + + delete this.$options.mpType; + delete this.$options.mpInstance; + if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n + const app = getApp(); + if (app.$vm && app.$vm.$i18n) { + this._i18n = app.$vm.$i18n; + } + } + if (this.mpType !== 'app') { + initRefs(this); + initMocks(this, mocks); + } + } + }); + + const appOptions = { + onLaunch (args) { + if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前 + return + } + { + if (wx.canIUse && !wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断 + console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上'); + } + } + + this.$vm = vm; + + this.$vm.$mp = { + app: this + }; + + this.$vm.$scope = this; + // vm 上也挂载 globalData + this.$vm.globalData = this.globalData; + + this.$vm._isMounted = true; + this.$vm.__call_hook('mounted', args); + + this.$vm.__call_hook('onLaunch', args); + } + }; + + // 兼容旧版本 globalData + appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } + + initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans'); + + initHooks(appOptions, hooks); + + return appOptions } const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__']; diff --git a/packages/uni-mp-weixin/dist/uni.api.esm.js b/packages/uni-mp-weixin/dist/uni.api.esm.js index c24f019cdbd71123758ac2b70755b6f27a93cba9..73796b96e9bd80b7c4fe34d4ca17f7b93ee80076 100644 --- a/packages/uni-mp-weixin/dist/uni.api.esm.js +++ b/packages/uni-mp-weixin/dist/uni.api.esm.js @@ -437,7 +437,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce else if (isPlainObject(method)) { removeInterceptorHook(globalInterceptors, method); } -}, RemoveInterceptorProtocol); +}, RemoveInterceptorProtocol); +const interceptors = {}; const API_ON = '$on'; const OnProtocol = [ @@ -717,7 +718,10 @@ const onLocaleChange = (fn) => { if (onLocaleChangeCallbacks.indexOf(fn) === -1) { onLocaleChangeCallbacks.push(fn); } -}; +}; +if (typeof global !== 'undefined') { + global.getLocale = getLocale; +} const baseApis = { $on, @@ -725,6 +729,7 @@ const baseApis = { $once, $emit, upx2px, + interceptors, addInterceptor, removeInterceptor, onAppLaunch, diff --git a/packages/uni-quickapp-native/dist/vue.dev.js b/packages/uni-quickapp-native/dist/vue.dev.js index d6964e0ebcd39ee6037663d540cd5624b27f0dab..4beb79f68ecb5caa56b926fddd9da8bbfd3fb8b1 100644 --- a/packages/uni-quickapp-native/dist/vue.dev.js +++ b/packages/uni-quickapp-native/dist/vue.dev.js @@ -1,4 +1,4 @@ var dsl=function(){"use strict";const e={initApp:"quickapp.app.initApp",initPage:"quickapp.page.initPage",destroyPage:"quickapp.page.destroyPage",fireEvent:"quickapp.page.fireEvent",onShow:"quickapp.page.onShow",onHide:"quickapp.page.onHide",onBackPress:"quickapp.page.onBackPress",onMenuPress:"quickapp.page.onMenuPress",onOrientationChange:"quickapp.page.onOrientationChange",onConfigurationChanged:"quickapp.page.onConfigurationChanged",onRefresh:"quickapp.page.onRefresh",callbackDone:"quickapp.page.callbackDone"},t=/^@(app)-application\//,n=/^@(app)-component\//,r=/^@(app)-module\//;function o(e){return e.replace(t,"").replace(n,"").replace(r,"")}var i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var a,s,c=(function(e){e.exports=function(e,t,n){var r=Object.freeze({});function o(e){return null==e}function a(e){return null!=e}function s(e){return!0===e}function c(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function u(e){return null!==e&&"object"==typeof e}var l=Object.prototype.toString;function p(e){return l.call(e).slice(8,-1)}function f(e){return"[object Object]"===l.call(e)}function d(e){return"[object RegExp]"===l.call(e)}function v(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return a(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function m(e){return null==e?"":Array.isArray(e)||f(e)&&e.toString===l?JSON.stringify(e,null,2):String(e)}function y(e){var t=parseFloat(e);return isNaN(t)?e:t}function g(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function A(e,t){return w.call(e,t)}function k(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var x=/-(\w)/g,O=k(function(e){return e.replace(x,function(e,t){return t?t.toUpperCase():""})}),C=k(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),S=/\B([A-Z])/g,j=k(function(e){return e.replace(S,"-$1").toLowerCase()});var E=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function I(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function P(e,t){for(var n in t)e[n]=t[n];return e}function M(e,t,n){}var T=function(e,t,n){return!1},F=function(e){return e};function D(e,t){if(e===t)return!0;var n=u(e),r=u(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),i=Array.isArray(t);if(o&&i)return e.length===t.length&&e.every(function(e,n){return D(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||i)return!1;var a=Object.keys(e),s=Object.keys(t);return a.length===s.length&&a.every(function(n){return D(e[n],t[n])})}catch(e){return!1}}function N(e,t){for(var n=0;n0,te=X&&X.indexOf("edge/")>0,ne=(X&&X.indexOf("android"),X&&/iphone|ipad|ipod|ios/.test(X)||"ios"===G),re=(X&&/chrome\/\d+/.test(X),X&&/phantomjs/.test(X),X&&X.match(/firefox\/(\d+)/),{}.watch);if(Q)try{var oe={};Object.defineProperty(oe,"passive",{get:function(){}}),window.addEventListener("test-passive",null,oe)}catch(e){}var ie=function(){return void 0===W&&(W=!Q&&!Y&&void 0!==i&&(i.process&&"server"===i.process.env.VUE_ENV)),W},ae=Q&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function se(e){return"function"==typeof e&&/native code/.test(e.toString())}var ce,ue="undefined"!=typeof Symbol&&se(Symbol)&&"undefined"!=typeof Reflect&&se(Reflect.ownKeys);ce="undefined"!=typeof Set&&se(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var le=M,pe=M,fe=M,de=M,ve="undefined"!=typeof console,he=/(?:^|[-_])(\w)/g;le=function(e,t){var n=t?fe(t):"";B.warnHandler?B.warnHandler.call(null,e,t,n):ve&&!B.silent&&console.error("[Vue warn]: "+e+n)},pe=function(e,t){ve&&!B.silent&&console.warn("[Vue tip]: "+e+(t?fe(t):""))},de=function(e,t){if(e.$root===e)return"";var n="function"==typeof e&&null!=e.cid?e.options:e._isVue?e.$options||e.constructor.options:e,r=n.name||n._componentTag,o=n.__file;if(!r&&o){var i=o.match(/([^/\\]+)\.vue$/);r=i&&i[1]}return(r?"<"+r.replace(he,function(e){return e.toUpperCase()}).replace(/[-_]/g,"")+">":"")+(o&&!1!==t?" at "+o:"")};fe=function(e){if(e._isVue&&e.$parent){for(var t=[],n=0;e;){if(t.length>0){var r=t[t.length-1];if(r.constructor===e.constructor){n++,e=e.$parent;continue}n>0&&(t[t.length-1]=[r,n],n=0)}t.push(e),e=e.$parent}return"\n\nfound in\n\n"+t.map(function(e,t){return""+(0===t?"---\x3e ":function(e,t){for(var n="";t;)t%2==1&&(n+=e),t>1&&(e+=e),t>>=1;return n}(" ",5+2*t))+(Array.isArray(e)?de(e[0])+"... ("+e[1]+" recursive calls)":de(e))}).join("\n")}return"\n\n(found in "+de(e)+")"};var me=0,ye=function(){"undefined"!=typeof SharedObject?this.id=SharedObject.uid++:this.id=me++,this.subs=[]};function ge(e){ye.SharedObject.targetStack.push(e),ye.SharedObject.target=e}function _e(){ye.SharedObject.targetStack.pop(),ye.SharedObject.target=ye.SharedObject.targetStack[ye.SharedObject.targetStack.length-1]}ye.prototype.addSub=function(e){this.subs.push(e)},ye.prototype.removeSub=function(e){$(this.subs,e)},ye.prototype.depend=function(){ye.SharedObject.target&&ye.SharedObject.target.addDep(this)},ye.prototype.notify=function(){var e=this.subs.slice();B.async||e.sort(function(e,t){return e.id-t.id});for(var t=0,n=e.length;t-1)if(i&&!A(o,"default"))a=!1;else if(""===a||a===j(e)){var c=Ye(String,o.type);(c<0||s0&&(Pt((u=e(u,(n||"")+"_"+i))[0])&&Pt(p)&&(r[l]=Ae(p.text+u[0].text),u.shift()),r.push.apply(r,u)):c(u)?Pt(p)?r[l]=Ae(p.text+u):""!==u&&r.push(Ae(u)):Pt(u)&&Pt(p)?r[l]=Ae(p.text+u.text):(s(t._isVList)&&a(u.tag)&&o(u.key)&&a(n)&&(u.key="__vlist"+n+"_"+i+"__"),r.push(u)));return r}(e):void 0}function Pt(e){return a(e)&&a(e.text)&&!1===e.isComment}function Mt(e,t){if(e){for(var n=Object.create(null),r=ue?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==r&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in o={},e)e[c]&&"$"!==c[0]&&(o[c]=Nt(t,c,e[c]))}else o={};for(var u in t)u in o||(o[u]=Lt(t,u));return e&&Object.isExtensible(e)&&(e._normalized=o),z(o,"$stable",a),z(o,"$key",s),z(o,"$hasNormal",i),o}function Nt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:It(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function Lt(e,t){return function(){return e[t]}}function qt(e,t){var n,r,o,i,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;r.",e),l=new be(B.parsePlatformTagName(t),n,r,void 0,void 0,e)):l=n&&n.pre||!a(f=Ue(e.$options,"components",t))?new be(t,n,r,void 0,void 0,e):an(f,n,e,r,t)}else l=an(t,n,e,r);return Array.isArray(l)?l:a(l)?(a(p)&&function e(t,n,r){t.ns=n;"foreignObject"===t.tag&&(n=void 0,r=!0);if(a(t.children))for(var i=0,c=t.children.length;it.createEvent("Event").timeStamp&&(In=function(){return Pn.now()})}function Mn(){var e,t;for(In(),jn=!0,kn.sort(function(e,t){return e.id-t.id}),En=0;EnAn)){le("You may have an infinite update loop "+(e.user?'in watcher with expression "'+e.expression+'"':"in a component render function."),e.vm);break}var n=xn.slice(),r=kn.slice();En=kn.length=xn.length=0,On={},Cn={},Sn=jn=!1,function(e){for(var t=0;tEn&&kn[n].id>e.id;)n--;kn.splice(n+1,0,e)}else kn.push(e);if(!Sn){if(Sn=!0,!B.async)return void Mn();ft(Mn)}}}(this)},Fn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||u(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Ze(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Fn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Fn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},Fn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||$(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Dn={enumerable:!0,configurable:!0,get:M,set:M};function Nn(e,t,n){Dn.get=function(){return this[t][n]},Dn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Dn)}function Ln(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[],i=!e.$parent;i||je(!1);var a=function(a){o.push(a);var s=ze(a,t,n,e),c=j(a);(b(c)||B.isReservedAttr(c))&&le('"'+c+'" is a reserved attribute and cannot be used as component prop.',e),Pe(r,a,s,function(){i||_n||le("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+a+'"',e)}),a in e||Nn(e,"_props",a)};for(var s in t)a(s);je(!0)}(e,t.props),t.methods&&function(e,t){var n=e.$options.props;for(var r in t)"function"!=typeof t[r]&&le('Method "'+r+'" has type "'+typeof t[r]+'" in the component definition. Did you reference the function correctly?',e),n&&A(n,r)&&le('Method "'+r+'" has already been defined as a prop.',e),r in e&&U(r)&&le('Method "'+r+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),e[r]="function"!=typeof t[r]?M:E(t[r],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;f(t=e._data="function"==typeof t?function(e,t){ge();try{return e.call(t,t)}catch(e){return Ze(e,t,"data()"),{}}finally{_e()}}(t,e):t||{})||(t={},le("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",e));var n=Object.keys(t),r=e.$options.props,o=e.$options.methods,i=n.length;for(;i--;){var a=n[i];o&&A(o,a)&&le('Method "'+a+'" has already been defined as a data property.',e),r&&A(r,a)?le('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',e):U(a)||Nn(e,"_data",a)}Ie(t,!0)}(e):Ie(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ie();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;null==a&&le('Getter is missing for computed property "'+o+'".',e),r||(n[o]=new Fn(e,a||M,M,qn)),o in e?o in e.$data?le('The computed property "'+o+'" is already defined in data.',e):e.$options.props&&o in e.$options.props&&le('The computed property "'+o+'" is already defined as a prop.',e):Rn(e,o,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!d(e)&&e.test(t)}function Yn(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=Kn(a.componentOptions);s&&!t(s)&&Gn(n,i,r,o)}}}function Gn(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,$(n,t)}!function(e){e.prototype._init=function(e){var t,n,o=this;o._uid=Un++,B.performance&&bt&&(t="vue-perf-start:"+o._uid,n="vue-perf-end:"+o._uid,bt(t)),o._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(o,e):o.$options=He(zn(o.constructor),e||{},o),ot(o),o._self=o,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(o),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&yn(e,t)}(o),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,o=n&&n.context;e.$slots=Tt(t._renderChildren,o),e.$scopedSlots=r,e._c=function(t,n,r,o){return ln(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return ln(e,t,n,r,o,!0)};var i=n&&n.data;Pe(e,"$attrs",i&&i.attrs||r,function(){!_n&&le("$attrs is readonly.",e)},!0),Pe(e,"$listeners",t._parentListeners||r,function(){!_n&&le("$listeners is readonly.",e)},!0)}(o),wn(o,"beforeCreate"),"mp-toutiao"!==o.mpHost&&function(e){var t=Mt(e.$options.inject,e);t&&(je(!1),Object.keys(t).forEach(function(n){Pe(e,n,t[n],function(){le('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+n+'"',e)})}),je(!0))}(o),Ln(o),"mp-toutiao"!==o.mpHost&&function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(o),"mp-toutiao"!==o.mpHost&&wn(o,"created"),B.performance&&bt&&(o._name=de(o,!1),bt(n),$t("vue "+o._name+" init",t,n)),o.$options.el&&o.$mount(o.$options.el)}}(Jn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};t.set=function(){le("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){le("$props is readonly.",this)},Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Me,e.prototype.$delete=Te,e.prototype.$watch=function(e,t,n){if(f(t))return Hn(this,e,t,n);(n=n||{}).user=!0;var r=new Fn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Ze(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(Jn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?I(r):r;for(var o=I(arguments,1),i='event handler for "'+e+'"',a=0,s=r.length;aparseInt(this.max)&&Gn(s,c[0],c,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return B},set:function(){le("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(e,"config",t),e.util={warn:le,extend:P,mergeOptions:He,defineReactive:Pe},e.set=Me,e.delete=Te,e.nextTick=ft,e.observable=function(e){return Ie(e),e},e.options=Object.create(null),R.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,P(e.options.components,Zn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=I(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=He(this.options,e),this}}(e),Wn(e),function(e){R.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&Ve(e),"component"===t&&f(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(Jn),Object.defineProperty(Jn.prototype,"$isServer",{get:ie}),Object.defineProperty(Jn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Jn,"FunctionalRenderContext",{value:en}),Jn.version="2.6.11";function er(e,t,r){n.setElementAttr(e,t,r)}var tr=Object.freeze({namespaceMap:{},createElement:function(e){var r=t.createElement(e);return n.bindElementMethods(r),r},createElementNS:function(e,n){return t.createElement(e+":"+n)},createTextNode:function(e){return t.createTextNode(e)},createComment:function(e){return t.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){n.setElementAttr(e.parentNode,"value",t)},setAttribute:er}),nr={create:function(e,t){rr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(rr(e,!0),rr(t))},destroy:function(e){rr(e,!0)}};function rr(e,t){var n=e.data.ref;if(a(n)){var r=e.context,o=e.componentInstance||e.elm,i=r.$refs;t?Array.isArray(i[n])?$(i[n],o):i[n]===o&&(i[n]=void 0):e.data.refInFor?Array.isArray(i[n])?i[n].indexOf(o)<0&&i[n].push(o):i[n]=[o]:i[n]=o}}g("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),g("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0);var or=g("text,number,password,search,email,tel,url"),ir=new be("",{},[]),ar=["create","activate","update","remove","destroy"];function sr(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&a(e.data)===a(t.data)&&function(e,t){if("input"!==e.tag)return!0;var n,r=a(n=e.data)&&a(n=n.attrs)&&n.type,o=a(n=t.data)&&a(n=n.attrs)&&n.type;return r===o||or(r)&&or(o)}(e,t)||s(e.isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&o(t.asyncFactory.error))}function cr(e,t,n){var r,o,i={};for(r=t;r<=n;++r)a(o=e[r].key)&&(i[o]=r);return i}var ur={create:lr,update:lr,destroy:function(e){lr(e,ir)}};function lr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,o,i=e===ir,a=t===ir,s=fr(e.data.directives,e.context),c=fr(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,vr(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(vr(o,"bind",t,e),o.def&&o.def.inserted&&u.push(o));if(u.length){var p=function(){for(var n=0;n1,j=t.context.$options.style||{},E=j[$],I=j["@TRANSITION"]&&j["@TRANSITION"][A]||{},T=function(e,t,n,r,o,i){var a={},s=t[n],c=t[r],u=t[o];if(s)for(var l in s)a[l]=e.style[l],null!=a[l]||u&&null!=u[l]||c&&null!=c[l]||le('transition property "'+l+'" is declared in enter starting class (.'+n+"), but not declared anywhere in enter ending class (."+r+"), enter active cass (."+o+") or the element's default styling. Note in Quickapp, CSS properties need explicit values to be transitionable.");if(u)for(var p in u)0!==p.indexOf("transition")&&(a[p]=u[p]);c&&P(a,c);return a}(n,j,$,w,A,t.context),F=Object.keys(T).length>0,D=n._enterCb=L(function(){D.cancelled?C&&C(n):O&&O(n),n._enterCb=null});if(setTimeout(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];(r&&r.context===t.context&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),x&&x(n,D),F)?t.context.$requireQuickappModule("animation").transition(n.ref,{styles:T,duration:I.duration||0,delay:I.delay||0,timingFunction:I.timingFunction||"linear"},S?M:D):S||D()},16),k&&k(n),E)for(var N in E)n.setStyle(N,E[N]);F||S||D()}}}function qr(e,t){if(!o(e.data.domProps)||!o(t.data.domProps)){var n,r,i=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in a(c.__ob__)&&(c=t.data.domProps=P({},c)),s)o(c[n])&&er(i,n,"");for(n in c){if(r=c[n],"value"===n)er(i,n,o(r)?"":String(r));else er(i,n,r)}}}var Rr=function(e){var t,n,r={},i=e.modules,u=e.nodeOps;for(t=0;t - did you register the component correctly? For recursive components, make sure to provide the "name" option.',e.context),e.elm=e.ns?u.createElementNS(e.ns,g):u.createElement(g,e),$(e),y(e,v,t),a(d)&&b(e,t),m(n,e.elm,o),d&&d.pre&&f--):s(e.isComment)?(e.elm=u.createComment(e.text),m(n,e.elm,o)):(e.elm=u.createTextNode(e.text),m(n,e.elm,o))}}function h(e,t){a(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,_(e)?(b(e,t),$(e)):(rr(e),t.push(e))}function m(e,t,n){a(e)&&(a(n)?u.parentNode(n)===e&&u.insertBefore(e,t,n):u.appendChild(e,t))}function y(e,t,n){if(Array.isArray(t)){O(t);for(var r=0;rd?w(e,o(n[y+1])?null:n[y+1].elm,n,f,y,r):f>y&&k(t,p,d)}(p,h,m,n,l):a(m)?(O(m),a(e.text)&&u.setTextContent(p,""),w(p,null,m,0,m.length-1,n)):a(h)?k(h,0,h.length-1):a(e.text)&&u.setTextContent(p,""):e.text!==t.text&&u.setTextContent(p,t.text),a(d)&&a(f=d.hook)&&a(f=f.postpatch)&&f(e,t)}}}function j(e,t,n){if(s(n)&&a(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r, or missing . Bailing hydration and performing full client-side render.")}c=e,e=new be(u.tagName(c).toLowerCase(),{},[],void 0,c)}var d=e.elm,h=u.parentNode(d);if(v(t,p,d._leaveCb?null:h,u.nextSibling(d)),a(t.parent))for(var m=t.parent,y=_(t);m;){for(var g=0;g1,d=e.context.$options.style||{},v=d[o],h=d[i]||d[a],m=d["@TRANSITION"]&&d["@TRANSITION"][a]||{},y=n._leaveCb=L(function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[e.key]=null),y.cancelled?l&&l(n):(t(),u&&u(n)),n._leaveCb=null});p?p(g):g();function g(){var t=e.context.$requireQuickappModule("animation");function r(){t.transition(n.ref,{styles:h,duration:m.duration||0,delay:m.delay||0,timingFunction:m.timingFunction||"linear"},f?M:y)}y.cancelled||(e.data.show||((n.parentNode._pending||(n.parentNode._pending={}))[e.key]=e),s&&s(n),v?t.transition(n.ref,{styles:v},r):r(),c&&c(n,y),h||f||y())}}}].concat(hr),LONG_LIST_THRESHOLD:10}),Vr={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?St(n,"postpatch",function(){Vr.componentUpdated(e,t,n)}):Br(e,t,n.context),e._vOptions=[].map.call(e.options,Ur)):("textarea"===n.tag||kr(e.attr.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||e.addEventListener("change",zr))},componentUpdated:function(e,t,n){if("select"===n.tag){Br(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,Ur);if(o.some(function(e,t){return!D(e,r[t])}))(e.multiple?t.value.some(function(e){return Hr(e,o)}):t.value!==t.oldValue&&Hr(t.value,o))&&Jr(e,"change")}}};function Br(e,t,n){!function(e,t,n){var r,o,i=t.value,a=e.multiple;if(a&&!Array.isArray(i))return void le('