-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 更新 image upload 组件的 axml (#942)
* feat: add copy script * feat: update generate code * docs: update prompt * feat: 更新 image upload * fix: 更新 axml * feat: 更新 image upload 组件 * feat: 更新 image upload demo 页面 * feat: 更新 image upload 组件的 --------- Co-authored-by: DiamondYuan <fandi.yfd@antgroup.com>
- Loading branch information
1 parent
ba88583
commit 166c3a2
Showing
26 changed files
with
482 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
Page({ | ||
data: { | ||
defaultFileList: [{ | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*znK_ToIL8rQAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*kStORbDQxwMAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*K4Z-RLHuliYAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}], | ||
}, | ||
onChange(fileList) { | ||
// 这里的数据包括上传失败和成功的图片列表,如果需要筛选出上传成功的图片需要在此处理 | ||
console.log('图片列表:', fileList); | ||
}, | ||
onUpload(file) { | ||
return new Promise((resolve) => { | ||
console.log('上传的图片为:', file); | ||
setTimeout(() => { | ||
resolve('https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*5m0ZQYhxhjEAAAAAAAAAAAAAARQnAQ'); | ||
}, 2000); | ||
}) | ||
}, | ||
onRemove(file) { | ||
return new Promise((resolve) => { | ||
console.log('即将移除的图片为:', file); | ||
my.confirm({ | ||
title: '是否确认移除图片', | ||
confirmButtonText: '确定', | ||
cancelButtonText: '取消', | ||
success: (e) => { | ||
resolve(e.confirm); | ||
} | ||
}); | ||
}) | ||
}, | ||
onBeforeUpload(localFileList) { | ||
console.log('即将上传的图片列表为:', localFileList); | ||
localFileList = localFileList.filter(item => item.size < 10000); | ||
console.log('修改上传的图片列表为:', localFileList); | ||
return localFileList; | ||
} | ||
data: { | ||
defaultFileList: [{ | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*znK_ToIL8rQAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*kStORbDQxwMAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*K4Z-RLHuliYAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}], | ||
}, | ||
onChange: function (fileList) { | ||
// 这里的数据包括上传失败和成功的图片列表,如果需要筛选出上传成功的图片需要在此处理 | ||
console.log('图片列表:', fileList); | ||
}, | ||
onUpload: function (file) { | ||
return new Promise(function (resolve) { | ||
console.log('上传的图片为:', file); | ||
setTimeout(function () { | ||
resolve('https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*5m0ZQYhxhjEAAAAAAAAAAAAAARQnAQ'); | ||
}, 2000); | ||
}); | ||
}, | ||
onRemove: function (file) { | ||
return new Promise(function (resolve) { | ||
console.log('即将移除的图片为:', file); | ||
my.confirm({ | ||
title: '是否确认移除图片', | ||
confirmButtonText: '确定', | ||
cancelButtonText: '取消', | ||
success: function (e) { | ||
resolve(e.confirm); | ||
} | ||
}); | ||
}); | ||
}, | ||
onBeforeUpload: function (localFileList) { | ||
console.log('即将上传的图片列表为:', localFileList); | ||
localFileList = localFileList.filter(function (item) { return item.size < 10000; }); | ||
console.log('修改上传的图片列表为:', localFileList); | ||
return localFileList; | ||
} | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
<container title="受控模式"> | ||
<uploader | ||
fileList="{{fileList}}" | ||
fileList="{{ fileList }}" | ||
onChange="onChange" | ||
onUpload="onUpload" /> | ||
</container> | ||
|
||
<container title="手动触发上传"> | ||
<uploader | ||
ref="handleUploaderRef" | ||
fileList="{{fileList}}" | ||
fileList="{{ fileList }}" | ||
onChange="onChange" | ||
onUpload="onUpload" /> | ||
<button | ||
size="default" | ||
<ant-button | ||
size="medium" | ||
onTap="upload" | ||
type="primary"> | ||
上传 | ||
</button> | ||
</ant-button> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
Page({ | ||
data: { | ||
fileList: [{ | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*znK_ToIL8rQAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*kStORbDQxwMAAAAAAAAAAAAAARQnAQ', | ||
status: 'pending', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*K4Z-RLHuliYAAAAAAAAAAAAAARQnAQ', | ||
status: 'error', | ||
}], | ||
}, | ||
onChange(fileList) { | ||
this.setData({ | ||
fileList, | ||
}); | ||
}, | ||
handleUploaderRef(ref){ | ||
this.handleUploaderRef = ref; | ||
}, | ||
upload(){ | ||
this.handleUploaderRef.chooseImage() | ||
}, | ||
onUpload(file) { | ||
console.log('当前上传的图片为:', file); | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve('https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*5m0ZQYhxhjEAAAAAAAAAAAAAARQnAQ'); | ||
}, 2000); | ||
}) | ||
}, | ||
data: { | ||
fileList: [{ | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*znK_ToIL8rQAAAAAAAAAAAAAARQnAQ', | ||
status: 'done', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*kStORbDQxwMAAAAAAAAAAAAAARQnAQ', | ||
status: 'pending', | ||
}, { | ||
url: 'https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*K4Z-RLHuliYAAAAAAAAAAAAAARQnAQ', | ||
status: 'error', | ||
}], | ||
}, | ||
onChange: function (fileList) { | ||
this.setData({ | ||
fileList: fileList, | ||
}); | ||
}, | ||
handleUploaderRef: function (ref) { | ||
this.handleUploaderRef = ref; | ||
}, | ||
upload: function () { | ||
this.handleUploaderRef.chooseImage(); | ||
}, | ||
onUpload: function (file) { | ||
console.log('当前上传的图片为:', file); | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
resolve('https://gw.alipayobjects.com/mdn/rms_226d75/afts/img/A*5m0ZQYhxhjEAAAAAAAAAAAAAARQnAQ'); | ||
}, 2000); | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,5 @@ export interface Props { | |
hidden?: any; | ||
enableNative?: any; | ||
disabled?: boolean; | ||
fileList?: any; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.