-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DiamondYuan
committed
Dec 11, 2023
1 parent
a01a7d7
commit 21f1830
Showing
10 changed files
with
63 additions
and
59 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
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.
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { InternalData } from 'tsxml'; | ||
import Container from '../../../src/Container/index.axml'; | ||
import Uploader from '../../../src/ImageUpload/index.axml'; | ||
import AntButton from '../../../src/Button/index.axml'; | ||
|
||
export default (_: any, { fileList }: InternalData) => ( | ||
<Page> | ||
<Container title="受控模式"> | ||
<Uploader fileList={fileList} onChange="onChange" onUpload="onUpload" /> | ||
</Container> | ||
<Container title="手动触发上传"> | ||
<Uploader | ||
ref="handleUploaderRef" | ||
fileList={fileList} | ||
onChange="onChange" | ||
onUpload="onUpload" | ||
/> | ||
<AntButton size="medium" onTap="upload" type="primary"> | ||
上传 | ||
</AntButton> | ||
</Container> | ||
</Page> | ||
); |
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.
File renamed without changes.