mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Uploader): add uploader disabled style (#5628)
This commit is contained in:
parent
8cab62025c
commit
613ff25035
@ -790,6 +790,7 @@
|
|||||||
@uploader-mask-message-line-height: 14px;
|
@uploader-mask-message-line-height: 14px;
|
||||||
@uploader-loading-icon-size: 22px;
|
@uploader-loading-icon-size: 22px;
|
||||||
@uploader-loading-icon-color: @white;
|
@uploader-loading-icon-color: @white;
|
||||||
|
@uploader-disabled-opacity: @disabled-opacity;
|
||||||
|
|
||||||
// Sku
|
// Sku
|
||||||
@sku-item-background-color: @background-color;
|
@sku-item-background-color: @background-color;
|
||||||
|
@ -44,6 +44,11 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
### Disabled
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-uploader disabled />
|
||||||
|
```
|
||||||
|
|
||||||
### Upload Status
|
### Upload Status
|
||||||
|
|
||||||
|
@ -53,6 +53,14 @@ export default {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 禁用
|
||||||
|
|
||||||
|
通过`disabled`属性禁用文件上传
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-uploader disabled />
|
||||||
|
```
|
||||||
|
|
||||||
### 上传状态
|
### 上传状态
|
||||||
|
|
||||||
通过`status`属性可以标识上传状态,`uploading`表示上传中,`failed`表示上传失败,`done`表示上传完成(从 2.4.7 版本开始支持)
|
通过`status`属性可以标识上传状态,`uploading`表示上传中,`failed`表示上传失败,`done`表示上传完成(从 2.4.7 版本开始支持)
|
||||||
@ -190,7 +198,7 @@ export default {
|
|||||||
| 事件名 | 说明 | 回调参数 |
|
| 事件名 | 说明 | 回调参数 |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
| oversize | 文件大小超过限制时触发 | 同`after-read` |
|
| oversize | 文件大小超过限制时触发 | 同`after-read` |
|
||||||
| click-preview | 点击预览图时触发 | 同`after-read` |
|
| click-preview | 点击预览图时触发 | 同`after-read` |
|
||||||
| close-preview | 关闭全屏图片预览时触发 | - |
|
| close-preview | 关闭全屏图片预览时触发 | - |
|
||||||
| delete | 删除文件预览时触发 | 同`after-read` |
|
| delete | 删除文件预览时触发 | 同`after-read` |
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
<van-uploader v-model="fileList" multiple accept="*" />
|
<van-uploader v-model="fileList" multiple accept="*" />
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
|
<demo-block :title="$t('disabled')">
|
||||||
|
<van-uploader :after-read="afterRead" disabled />
|
||||||
|
</demo-block>
|
||||||
|
|
||||||
<demo-block v-if="!isWeapp" :title="$t('status')">
|
<demo-block v-if="!isWeapp" :title="$t('status')">
|
||||||
<van-uploader v-model="statusFileList" :after-read="afterReadFailed" />
|
<van-uploader v-model="statusFileList" :after-read="afterReadFailed" />
|
||||||
</demo-block>
|
</demo-block>
|
||||||
@ -38,6 +42,7 @@ export default {
|
|||||||
failed: '上传失败',
|
failed: '上传失败',
|
||||||
upload: '上传文件',
|
upload: '上传文件',
|
||||||
preview: '文件预览',
|
preview: '文件预览',
|
||||||
|
disabled: '禁用',
|
||||||
maxCount: '限制上传数量',
|
maxCount: '限制上传数量',
|
||||||
uploading: '上传中...',
|
uploading: '上传中...',
|
||||||
beforeRead: '上传前校验',
|
beforeRead: '上传前校验',
|
||||||
@ -49,6 +54,7 @@ export default {
|
|||||||
failed: 'Failed',
|
failed: 'Failed',
|
||||||
upload: 'Upload File',
|
upload: 'Upload File',
|
||||||
preview: 'Preview File',
|
preview: 'Preview File',
|
||||||
|
disabled: 'Disabled',
|
||||||
maxCount: 'Max Count',
|
maxCount: 'Max Count',
|
||||||
uploading: 'Uploading...',
|
uploading: 'Uploading...',
|
||||||
beforeRead: 'Before Read',
|
beforeRead: 'Before Read',
|
||||||
|
@ -360,7 +360,7 @@ export default createComponent({
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class={bem()}>
|
<div class={bem()}>
|
||||||
<div class={bem('wrapper')}>
|
<div class={bem('wrapper', { disabled: this.disabled })}>
|
||||||
{this.genPreviewList()}
|
{this.genPreviewList()}
|
||||||
{this.genUpload()}
|
{this.genUpload()}
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
&__wrapper {
|
&__wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
&--disabled {
|
||||||
|
opacity: @uploader-disabled-opacity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__input {
|
&__input {
|
||||||
|
@ -32,6 +32,14 @@ exports[`renders demo correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="van-uploader">
|
||||||
|
<div class="van-uploader__wrapper van-uploader__wrapper--disabled">
|
||||||
|
<div class="van-uploader__upload"><i class="van-icon van-icon-plus van-uploader__upload-icon">
|
||||||
|
<!----></i><input type="file" accept="image/*" disabled="disabled" class="van-uploader__input"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="van-uploader">
|
<div class="van-uploader">
|
||||||
<div class="van-uploader__wrapper">
|
<div class="van-uploader__wrapper">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user