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

Merge branch 'dev'

...@@ -361,10 +361,15 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -361,10 +361,15 @@ const protocols = { // 需要做转换的 API 列表
previewImage: { previewImage: {
args (fromArgs) { args (fromArgs) {
// 支付宝小程序的 current 是索引值,而非图片地址。 // 支付宝小程序的 current 是索引值,而非图片地址。
const currentIndex = Number(fromArgs.current);
if (isNaN(currentIndex)) {
if (fromArgs.current && Array.isArray(fromArgs.urls)) { if (fromArgs.current && Array.isArray(fromArgs.urls)) {
const index = fromArgs.urls.indexOf(fromArgs.current); const index = fromArgs.urls.indexOf(fromArgs.current);
fromArgs.current = ~index ? index : 0; fromArgs.current = ~index ? index : 0;
} }
} else {
fromArgs.current = currentIndex;
}
return { return {
indicator: false, indicator: false,
loop: false loop: false
......
{ {
"name": "@dcloudio/uni-mp-alipay", "name": "@dcloudio/uni-mp-alipay",
"version": "0.0.802", "version": "0.0.803",
"description": "uni-app mp-alipay", "description": "uni-app mp-alipay",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -144,6 +144,34 @@ function upx2px (number, newDeviceWidth) { ...@@ -144,6 +144,34 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result 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 列表 // 不支持的 API 列表
const todos = [ const todos = [
'hideKeyboard', 'hideKeyboard',
...@@ -205,10 +233,13 @@ const protocols = { ...@@ -205,10 +233,13 @@ const protocols = {
} }
}, },
previewImage: { previewImage: {
args: { args (fromArgs) {
normalize(fromArgs);
return {
indicator: false, indicator: false,
loop: false loop: false
} }
}
}, },
getRecorderManager: { getRecorderManager: {
returnValue (fromRet) { returnValue (fromRet) {
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.828", "version": "0.0.829",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -144,6 +144,34 @@ function upx2px (number, newDeviceWidth) { ...@@ -144,6 +144,34 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result 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 列表 // 不支持的 API 列表
const todos = [ const todos = [
'hideKeyboard', 'hideKeyboard',
...@@ -238,10 +266,13 @@ const protocols = { ...@@ -238,10 +266,13 @@ const protocols = {
} }
}, },
previewImage: { previewImage: {
args: { args (fromArgs) {
normalize(fromArgs);
return {
indicator: false, indicator: false,
loop: false loop: false
} }
}
}, },
connectSocket: { connectSocket: {
args: { args: {
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.326", "version": "0.0.327",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -144,7 +144,39 @@ function upx2px (number, newDeviceWidth) { ...@@ -144,7 +144,39 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result return number < 0 ? -result : result
} }
const protocols = {}; 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 todos = [];
const canIUses = []; const canIUses = [];
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.950", "version": "0.0.951",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -19,9 +19,11 @@ export const previewImage = { ...@@ -19,9 +19,11 @@ export const previewImage = {
} }
}, },
current: { current: {
type: String, type: [String, Number],
validator (value, params) { 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) { ...@@ -671,10 +671,17 @@ methods3.forEach(function (method) {
case 'setFillStyle': case 'setFillStyle':
case 'setStrokeStyle': case 'setStrokeStyle':
return function (color) { return function (color) {
if (typeof color !== 'object') {
this.actions.push({ this.actions.push({
method, method,
data: ['normal', checkColor(color)] data: ['normal', checkColor(color)]
}) })
} else {
this.actions.push({
method,
data: [color.type, color.data, color.colorStop]
})
}
} }
case 'setGlobalAlpha': case 'setGlobalAlpha':
return function (alpha) { return function (alpha) {
......
...@@ -163,6 +163,7 @@ export default { ...@@ -163,6 +163,7 @@ export default {
let color = resolveColor(data2[1]) let color = resolveColor(data2[1])
LinearGradient.addColorStop(offset, color) LinearGradient.addColorStop(offset, color)
}) })
color = LinearGradient
} else if (data[0] === 'radial') { } else if (data[0] === 'radial') {
let x = data[1][0] let x = data[1][0]
let y = data[1][1] let y = data[1][1]
...@@ -173,6 +174,7 @@ export default { ...@@ -173,6 +174,7 @@ export default {
let color = resolveColor(data2[1]) let color = resolveColor(data2[1])
LinearGradient.addColorStop(offset, color) LinearGradient.addColorStop(offset, color)
}) })
color = LinearGradient
} else if (data[0] === 'pattern') { } else if (data[0] === 'pattern') {
let loaded = this.checkImageLoaded(data[1], actions.slice(index + 1), callbackId, let loaded = this.checkImageLoaded(data[1], actions.slice(index + 1), callbackId,
function (image) { function (image) {
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
} }
}, },
created () { 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 this.index = index < 0 ? 0 : index
}, },
methods: { methods: {
......
...@@ -346,7 +346,8 @@ export default { ...@@ -346,7 +346,8 @@ export default {
this.$emit('boundsready') this.$emit('boundsready')
}) })
maps.event.addListener(map, 'click', () => { maps.event.addListener(map, 'click', () => {
this.$trigger('tap', {}, {}) // TODO 编译器将 tap 转换为click
this.$trigger('click', {}, {})
}) })
maps.event.addListener(map, 'dragstart', () => { maps.event.addListener(map, 'dragstart', () => {
this.$trigger('regionchange', {}, { this.$trigger('regionchange', {}, {
......
...@@ -215,10 +215,15 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -215,10 +215,15 @@ const protocols = { // 需要做转换的 API 列表
previewImage: { previewImage: {
args (fromArgs) { args (fromArgs) {
// 支付宝小程序的 current 是索引值,而非图片地址。 // 支付宝小程序的 current 是索引值,而非图片地址。
const currentIndex = Number(fromArgs.current)
if (isNaN(currentIndex)) {
if (fromArgs.current && Array.isArray(fromArgs.urls)) { if (fromArgs.current && Array.isArray(fromArgs.urls)) {
const index = fromArgs.urls.indexOf(fromArgs.current) const index = fromArgs.urls.indexOf(fromArgs.current)
fromArgs.current = ~index ? index : 0 fromArgs.current = ~index ? index : 0
} }
} else {
fromArgs.current = currentIndex
}
return { return {
indicator: false, indicator: false,
loop: false loop: false
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args'
// 不支持的 API 列表 // 不支持的 API 列表
const todos = [ const todos = [
'hideKeyboard', 'hideKeyboard',
...@@ -59,10 +60,13 @@ const protocols = { ...@@ -59,10 +60,13 @@ const protocols = {
} }
}, },
previewImage: { previewImage: {
args: { args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false, indicator: false,
loop: false loop: false
} }
}
}, },
getRecorderManager: { getRecorderManager: {
returnValue (fromRet) { returnValue (fromRet) {
......
import normalizePreviewImageArgs from '../../../mp-weixin/helpers/normalize-preview-image-args'
// 不支持的 API 列表 // 不支持的 API 列表
const todos = [ const todos = [
'hideKeyboard', 'hideKeyboard',
...@@ -92,10 +94,13 @@ const protocols = { ...@@ -92,10 +94,13 @@ const protocols = {
} }
}, },
previewImage: { previewImage: {
args: { args (fromArgs) {
normalizePreviewImageArgs(fromArgs)
return {
indicator: false, indicator: false,
loop: false loop: false
} }
}
}, },
connectSocket: { connectSocket: {
args: { args: {
......
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 = {} import normalizePreviewImageArgs from '../../helpers/normalize-preview-image-args'
export const protocols = {
previewImage: {
args: normalizePreviewImageArgs
}
}
export const todos = [] export const todos = []
export const canIUses = [] export const canIUses = []
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册