提交 95628713 编写于 作者: Q qiang

fix: 优化 __map 方法支持遍历 number 类型(用于小程序端遍历 number 时内部遇到复杂表达式的情况)

上级 7c382d6f
......@@ -5925,7 +5925,7 @@ function internalMixin(Vue) {
};
Vue.prototype.__map = function(val, iteratee) {
//TODO 暂不考虑 string,number
//TODO 暂不考虑 string
var ret, i, l, keys, key;
if (Array.isArray(val)) {
ret = new Array(val.length);
......@@ -5941,6 +5941,13 @@ function internalMixin(Vue) {
ret[key] = iteratee(val[key], key, i);
}
return ret
} else if (typeof val === 'number') {
ret = new Array(val);
for (i = 0, l = val; i < l; i++) {
// 第一个参数暂时仍和小程序一致
ret[i] = iteratee(i, i);
}
return ret
}
return []
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册