提交 06ec6a07 编写于 作者: Y yurj26

chore(mp-toutiao): build

上级 9c20da3c
...@@ -687,8 +687,6 @@ class EventChannel { ...@@ -687,8 +687,6 @@ class EventChannel {
const eventChannels = {}; const eventChannels = {};
const eventChannelStack = [];
let id = 0; let id = 0;
function initEventChannel (events, cache = true) { function initEventChannel (events, cache = true) {
...@@ -696,31 +694,30 @@ function initEventChannel (events, cache = true) { ...@@ -696,31 +694,30 @@ function initEventChannel (events, cache = true) {
const eventChannel = new EventChannel(id, events); const eventChannel = new EventChannel(id, events);
if (cache) { if (cache) {
eventChannels[id] = eventChannel; eventChannels[id] = eventChannel;
eventChannelStack.push(eventChannel);
} }
return eventChannel return eventChannel
} }
function getEventChannel (id) { function getEventChannel (id) {
if (id) {
const eventChannel = eventChannels[id]; const eventChannel = eventChannels[id];
delete eventChannels[id]; delete eventChannels[id];
return eventChannel return eventChannel
}
return eventChannelStack.shift()
} }
var navigateTo = { function navigateTo () {
let eventChannel;
return {
args (fromArgs, toArgs) { args (fromArgs, toArgs) {
const id = initEventChannel(fromArgs.events).id; eventChannel = initEventChannel(fromArgs.events);
if (fromArgs.url) { if (fromArgs.url) {
fromArgs.url = fromArgs.url + (fromArgs.url.indexOf('?') === -1 ? '?' : '&') + '__id__=' + id; fromArgs.url = fromArgs.url + (fromArgs.url.indexOf('?') === -1 ? '?' : '&') + '__id__=' + eventChannel.id;
} }
}, },
returnValue (fromRes, toRes) { returnValue (fromRes, toRes) {
fromRes.eventChannel = getEventChannel(); fromRes.eventChannel = eventChannel;
} }
}; }
}
function findExistsPageIndex (url) { function findExistsPageIndex (url) {
const pages = getCurrentPages(); const pages = getCurrentPages();
...@@ -1045,7 +1042,7 @@ const canIUses = [ ...@@ -1045,7 +1042,7 @@ const canIUses = [
// 需要做转换的 API 列表 // 需要做转换的 API 列表
const protocols = { const protocols = {
navigateTo, navigateTo: navigateTo(),
redirectTo, redirectTo,
previewImage, previewImage,
getSystemInfo, getSystemInfo,
...@@ -2457,8 +2454,8 @@ function isPage () { ...@@ -2457,8 +2454,8 @@ function isPage () {
function initRefs$1 (vm) { function initRefs$1 (vm) {
const mpInstance = vm.$scope; const mpInstance = vm.$scope;
/* eslint-disable no-undef */ /* eslint-disable no-undef */
const minorVersion = parseInt(tt.getSystemInfoSync().SDKVersion.split('.')[1]); const [majorVersion = '', minorVersion = ''] = tt.getSystemInfoSync().SDKVersion.split('.');
if (minorVersion > 16) { if (parseInt(majorVersion) > 1 || parseInt(minorVersion) > 16) {
initRefs(vm); initRefs(vm);
} else { } else {
mpInstance.selectAllComponents('.vue-ref', (components) => { mpInstance.selectAllComponents('.vue-ref', (components) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册