Skip to content

Commit abec5a3

Browse files
committed
build: Travis CI automatic compilation
1 parent ab851bc commit abec5a3

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

dist/image-picker/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dist/image-picker/index.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ Component({
5858
maxImageSize: {
5959
type: Number,
6060
value: 10000000,
61+
},
62+
// 以对象方式传入图片链接
63+
cells: {
64+
type: Array,
65+
value: null
6166
}
6267
},
6368

@@ -72,12 +77,19 @@ Component({
7277
lifetimes: {
7378
attached: function () {
7479
// 在组件实例进入页面节点树时执行
75-
const newOrOld = this.judgeNewOrOld();
76-
this.setData({
77-
newOrOld
78-
});
79-
if (newOrOld === 'old') {
80-
console.warn('image-picker组件已经升级,建议使用最新版本,当前用法会在后续版本中暂停支持');
80+
let newOrOld = this.judgeNewOrOld();
81+
82+
// 对 cells 的兼容处理
83+
if (this.data.cells !== null) {
84+
newOrOld = 'new';
85+
this.setData({
86+
newOrOld,
87+
urls: this.data.cells
88+
});
89+
} else {
90+
this.setData({
91+
newOrOld
92+
});
8193
}
8294
},
8395
},
@@ -110,7 +122,14 @@ Component({
110122
let previewImageList = [];
111123
const newOrOld = this.data.newOrOld;
112124

113-
if (newOrOld === 'old') {
125+
// 第一个 if 是对 cells 的兼容处理
126+
if (typeof (this.data.cells) !== 'undefined') {
127+
const cells = this.data.cells;
128+
tempFilePath = cells[index].url;
129+
for (let i = 0; i < cells.length; i++) {
130+
previewImageList.push(cells[i].url);
131+
}
132+
} else if (newOrOld === 'old') {
114133
tempFilePath = this.data.urls[index];
115134
previewImageList = this.data.urls;
116135

0 commit comments

Comments
 (0)