提交 1198bbdb 编写于 作者: fxy060608's avatar fxy060608

build uni runtime(refactor previewImage)

上级 bc23156e
......@@ -144,33 +144,39 @@ 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];
var previewImage = {
args (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];
}
return {
indicator: false,
loop: false
}
}
}
};
// 不支持的 API 列表
const todos = [
......@@ -232,15 +238,7 @@ const protocols = {
method: false
}
},
previewImage: {
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
previewImage,
getRecorderManager: {
returnValue (fromRet) {
fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded');
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.829",
"version": "0.0.830",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -144,33 +144,39 @@ 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];
var previewImage = {
args (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];
}
return {
indicator: false,
loop: false
}
}
}
};
// 不支持的 API 列表
const todos = [
......@@ -265,15 +271,7 @@ const protocols = {
sizeType: false
}
},
previewImage: {
args (fromArgs) {
normalize(fromArgs);
return {
indicator: false,
loop: false
}
}
},
previewImage,
connectSocket: {
args: {
method: false
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.327",
"version": "0.0.328",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -144,38 +144,42 @@ 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];
var previewImage = {
args (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];
}
return {
indicator: false,
loop: false
}
}
}
};
const protocols = {
previewImage: {
args: normalize
}
previewImage
};
const todos = [];
const canIUses = [];
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.951",
"version": "0.0.952",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args'
import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// 不支持的 API 列表
const todos = [
'hideKeyboard',
......@@ -59,15 +59,7 @@ const protocols = {
method: false
}
},
previewImage: {
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
},
previewImage,
getRecorderManager: {
returnValue (fromRet) {
fromRet.onFrameRecorded = createTodoMethod('RecorderManager', 'onFrameRecorded')
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args'
import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// 不支持的 API 列表
const todos = [
......@@ -93,15 +93,7 @@ const protocols = {
sizeType: false
}
},
previewImage: {
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
},
previewImage,
connectSocket: {
args: {
method: false
......
export default 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]
}
}
export default {
args (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]
}
return {
indicator: false,
loop: false
}
}
}
import normalizePreviewImageArgs from '../../helpers/normalize-preview-image-args'
import previewImage from '../../helpers/normalize-preview-image'
export const protocols = {
previewImage: {
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
}
previewImage
}
export const todos = []
export const canIUses = []
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册