提交 8516fa70 编写于 作者: fxy060608's avatar fxy060608

build uni runtime(mp previewImage currentIndex)

上级 95068879
......@@ -361,9 +361,14 @@ const protocols = { // 需要做转换的 API 列表
previewImage: {
args (fromArgs) {
// 支付宝小程序的 current 是索引值,而非图片地址。
if (fromArgs.current && Array.isArray(fromArgs.urls)) {
const index = fromArgs.urls.indexOf(fromArgs.current);
fromArgs.current = ~index ? index : 0;
const currentIndex = Number(fromArgs.current);
if (isNaN(currentIndex)) {
if (fromArgs.current && Array.isArray(fromArgs.urls)) {
const index = fromArgs.urls.indexOf(fromArgs.current);
fromArgs.current = ~index ? index : 0;
}
} else {
fromArgs.current = currentIndex;
}
return {
indicator: false,
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "0.0.802",
"version": "0.0.803",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"scripts": {
......
......@@ -144,6 +144,34 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}
function normalize (fromArgs) {
let currentIndex = parseInt(fromArgs.current);
if (isNaN(currentIndex)) {
return
}
const urls = fromArgs.urls;
if (!Array.isArray(urls)) {
return
}
const len = urls.length;
if (!len) {
return
}
if (currentIndex < 0) {
currentIndex = 0;
} else if (currentIndex >= len) {
currentIndex = len - 1;
}
if (currentIndex > 0) {
fromArgs.current = urls[currentIndex];
fromArgs.urls = urls.filter(
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true
);
} else {
fromArgs.current = urls[0];
}
}
// 不支持的 API 列表
const todos = [
'hideKeyboard',
......@@ -205,9 +233,12 @@ const protocols = {
}
},
previewImage: {
args: {
indicator: false,
loop: false
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
getRecorderManager: {
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.828",
"version": "0.0.829",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -144,6 +144,34 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}
function normalize (fromArgs) {
let currentIndex = parseInt(fromArgs.current);
if (isNaN(currentIndex)) {
return
}
const urls = fromArgs.urls;
if (!Array.isArray(urls)) {
return
}
const len = urls.length;
if (!len) {
return
}
if (currentIndex < 0) {
currentIndex = 0;
} else if (currentIndex >= len) {
currentIndex = len - 1;
}
if (currentIndex > 0) {
fromArgs.current = urls[currentIndex];
fromArgs.urls = urls.filter(
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true
);
} else {
fromArgs.current = urls[0];
}
}
// 不支持的 API 列表
const todos = [
'hideKeyboard',
......@@ -238,9 +266,12 @@ const protocols = {
}
},
previewImage: {
args: {
indicator: false,
loop: false
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
connectSocket: {
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.326",
"version": "0.0.327",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -144,8 +144,40 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}
const protocols = {};
const todos = [];
function normalize (fromArgs) {
let currentIndex = parseInt(fromArgs.current);
if (isNaN(currentIndex)) {
return
}
const urls = fromArgs.urls;
if (!Array.isArray(urls)) {
return
}
const len = urls.length;
if (!len) {
return
}
if (currentIndex < 0) {
currentIndex = 0;
} else if (currentIndex >= len) {
currentIndex = len - 1;
}
if (currentIndex > 0) {
fromArgs.current = urls[currentIndex];
fromArgs.urls = urls.filter(
(item, index) => index < currentIndex ? item !== urls[currentIndex] : true
);
} else {
fromArgs.current = urls[0];
}
}
const protocols = {
previewImage: {
args: normalize
}
};
const todos = [];
const canIUses = [];
const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.950",
"version": "0.0.951",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册