提交 13a00b70 编写于 作者: M mehaotian

Merge branch 'dev'

......@@ -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": {
......
......@@ -19,9 +19,11 @@ export const previewImage = {
}
},
current: {
type: String,
type: [String, Number],
validator (value, params) {
params.type = value ? getRealPath(value) : ''
// 假值都会被转换为数字 0 无需再做判定
const index = Number(value)
params.current = isNaN(index) ? getRealPath(value) : index
}
}
}
......@@ -671,10 +671,17 @@ methods3.forEach(function (method) {
case 'setFillStyle':
case 'setStrokeStyle':
return function (color) {
this.actions.push({
method,
data: ['normal', checkColor(color)]
})
if (typeof color !== 'object') {
this.actions.push({
method,
data: ['normal', checkColor(color)]
})
} else {
this.actions.push({
method,
data: [color.type, color.data, color.colorStop]
})
}
}
case 'setGlobalAlpha':
return function (alpha) {
......
......@@ -163,6 +163,7 @@ export default {
let color = resolveColor(data2[1])
LinearGradient.addColorStop(offset, color)
})
color = LinearGradient
} else if (data[0] === 'radial') {
let x = data[1][0]
let y = data[1][1]
......@@ -173,6 +174,7 @@ export default {
let color = resolveColor(data2[1])
LinearGradient.addColorStop(offset, color)
})
color = LinearGradient
} else if (data[0] === 'pattern') {
let loaded = this.checkImageLoaded(data[1], actions.slice(index + 1), callbackId,
function (image) {
......
......@@ -33,7 +33,7 @@ export default {
}
},
created () {
var index = this.urls.indexOf(this.current)
const index = typeof this.current === 'number' ? this.current : this.urls.indexOf(this.current)
this.index = index < 0 ? 0 : index
},
methods: {
......
......@@ -346,7 +346,8 @@ export default {
this.$emit('boundsready')
})
maps.event.addListener(map, 'click', () => {
this.$trigger('tap', {}, {})
// TODO 编译器将 tap 转换为click
this.$trigger('click', {}, {})
})
maps.event.addListener(map, 'dragstart', () => {
this.$trigger('regionchange', {}, {
......
......@@ -215,9 +215,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,
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args'
// 不支持的 API 列表
const todos = [
'hideKeyboard',
......@@ -59,9 +60,12 @@ const protocols = {
}
},
previewImage: {
args: {
indicator: false,
loop: false
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
},
getRecorderManager: {
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args'
// 不支持的 API 列表
const todos = [
'hideKeyboard',
......@@ -92,9 +94,12 @@ const protocols = {
}
},
previewImage: {
args: {
indicator: false,
loop: false
args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false,
loop: false
}
}
},
connectSocket: {
......
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 const protocols = {}
export const todos = []
import normalizePreviewImageArgs from '../../helpers/normalize-preview-image-args'
export const protocols = {
previewImage: {
args: normalizePreviewImageArgs
}
}
export const todos = []
export const canIUses = []
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册