123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import ad from '../index/ad'
- ad({
- data: {
- fileList: [{
- uid: 0,
- status: 'uploading',
- url: 'http://cdn.skyvow.cn/qrcode.jpg',
- },
- {
- uid: 1,
- status: 'done',
- url: 'http://cdn.skyvow.cn/qrcode.jpg',
- },
- {
- uid: 2,
- status: 'error',
- url: 'http://cdn.skyvow.cn/qrcode.jpg',
- }],
- },
- onChange(e) {
- console.log('onChange', e)
- const { file, fileList } = e.detail
- if (file.status === 'uploading') {
- this.setData({
- progress: 0,
- })
- wx.showLoading()
- } else if (file.status === 'done') {
- this.setData({
- imageUrl: file.url,
- })
- }
- // Controlled state should set fileList
- this.setData({ fileList })
- },
- onSuccess(e) {
- console.log('onSuccess', e)
- },
- onFail(e) {
- console.log('onFail', e)
- },
- onComplete(e) {
- console.log('onComplete', e)
- wx.hideLoading()
- },
- onProgress(e) {
- console.log('onProgress', e)
- this.setData({
- progress: e.detail.file.progress,
- })
- },
- onPreview(e) {
- console.log('onPreview', e)
- const { file, fileList } = e.detail
- wx.previewImage({
- current: file.url,
- urls: fileList.map((n) => n.url),
- })
- },
- onRemove(e) {
- const { file, fileList } = e.detail
- wx.showModal({
- content: '确定删除?',
- success: (res) => {
- if (res.confirm) {
- this.setData({
- fileList: fileList.filter((n) => n.uid !== file.uid),
- })
- }
- },
- })
- },
- })
|