docs: prettier all markdown files

This commit is contained in:
chenjiahan
2020-04-11 09:17:33 +08:00
committed by neverland
parent 48067f79db
commit 7f84f8a487
140 changed files with 4441 additions and 4723 deletions
+55 -60
View File
@@ -21,9 +21,9 @@ Vue.use(Uploader);
export default {
methods: {
afterRead(file) {
console.log(file)
}
}
console.log(file);
},
},
};
```
@@ -37,13 +37,12 @@ export default {
export default {
data() {
return {
fileList: [
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' }
]
}
}
fileList: [{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' }],
};
},
};
```
### Disabled
```html
@@ -64,15 +63,15 @@ export default {
{
url: 'https://img.yzcdn.cn/vant/leaf.jpg',
status: 'uploading',
message: 'Uploading...'
message: 'Uploading...',
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
status: 'failed',
message: 'Failed'
}
]
}
message: 'Failed',
},
],
};
},
methods: {
afterRead(file) {
@@ -83,28 +82,24 @@ export default {
file.status = 'failed';
file.message = 'Failed';
}, 1000);
}
}
},
},
};
```
### Max Count
```html
<van-uploader
v-model="fileList"
multiple
:max-count="2"
/>
<van-uploader v-model="fileList" multiple :max-count="2" />
```
```js
export default {
data() {
return {
fileList: []
}
}
fileList: [],
};
},
};
```
@@ -140,15 +135,15 @@ export default {
Toast('Please upload an image in jpg format');
reject();
} else {
let img = new File(["foo"], "bar.jpg", {
type: "image/jpeg",
let img = new File(['foo'], 'bar.jpg', {
type: 'image/jpeg',
});
resolve(img);
}
});
}
}
}
},
},
};
```
## API
@@ -156,31 +151,31 @@ export default {
### Props
| Attribute | Description | Type | Default |
|------|------|------|------|
| accept | Accepted [file type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers) | *string* | `image/*` |
| name `v2.0.3` | Input name | *number \| string* | - |
| preview-size | Size of preview image | *number \| string* | `80px` |
| preview-image `v2.1.5` | Whether to show image preview | *boolean* | `true` |
| preview-full-image | Whethe to show full screen image preview when click image | *boolean* | `true` |
| multiple | Whether to enable multiple selection pictures | *boolean* | `false` |
| disabled | Whether to disabled the upload | *boolean* | `false` |
| deletable `v2.2.12` | Whether to show delete icon | *boolean* | `true` |
| show-upload `v2.5.6` | Whether to show upload area | *boolean* | `true` |
| capture | Capturecan be set to `camera` | *string* | - |
| after-read | Hook after reading the file | *Function* | - |
| before-read | Hook before reading the file, return false to stop reading the file, can return Promise | *Function* | - |
| before-delete | Hook before delete the file, return false to stop reading the file, can return Promise | *Function* | - |
| max-size | Max size of file | *number \| string* | - |
| max-count | Max count of image | *number \| string* | - |
| result-type `v2.2.7` | Type of file read result, can be set to `file` `text` | *string* | `dataUrl` |
| upload-text | Upload text | *string* | - |
| image-fit `v2.1.5` | Preview image fit mode | *string* | `cover` |
| upload-icon `v2.5.4` | Upload icon | *string* | `photograph` |
| --- | --- | --- | --- |
| accept | Accepted [file type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers) | _string_ | `image/*` |
| name `v2.0.3` | Input name | _number \| string_ | - |
| preview-size | Size of preview image | _number \| string_ | `80px` |
| preview-image `v2.1.5` | Whether to show image preview | _boolean_ | `true` |
| preview-full-image | Whethe to show full screen image preview when click image | _boolean_ | `true` |
| multiple | Whether to enable multiple selection pictures | _boolean_ | `false` |
| disabled | Whether to disabled the upload | _boolean_ | `false` |
| deletable `v2.2.12` | Whether to show delete icon | _boolean_ | `true` |
| show-upload `v2.5.6` | Whether to show upload area | _boolean_ | `true` |
| capture | Capturecan be set to `camera` | _string_ | - |
| after-read | Hook after reading the file | _Function_ | - |
| before-read | Hook before reading the file, return false to stop reading the file, can return Promise | _Function_ | - |
| before-delete | Hook before delete the file, return false to stop reading the file, can return Promise | _Function_ | - |
| max-size | Max size of file | _number \| string_ | - |
| max-count | Max count of image | _number \| string_ | - |
| result-type `v2.2.7` | Type of file read result, can be set to `file` `text` | _string_ | `dataUrl` |
| upload-text | Upload text | _string_ | - |
| image-fit `v2.1.5` | Preview image fit mode | _string_ | `cover` |
| upload-icon `v2.5.4` | Upload icon | _string_ | `photograph` |
### Events
| Event | Description | Arguments |
|------|------|------|
| --- | --- | --- |
| oversize | Triggered when file size over limit | Same as after-read |
| click-preview | Triggered when click preview image | Same as after-read |
| close-preview | Triggered when close full screen image preview | - |
@@ -188,23 +183,23 @@ export default {
### Slots
| Name | Description |
|------|------|
| Name | Description |
| ------- | ----------- |
| default | Custom icon |
### Parematers of before-read、after-read、before-delete
| Attribute | Description | Type |
|------|------|------|
| file | File object | *object* |
| detail | Detail info, contains name and index | *object* |
| Attribute | Description | Type |
| --------- | ------------------------------------ | -------- |
| file | File object | _object_ |
| detail | Detail info, contains name and index | _object_ |
### ResultType
| Value | Description |
|------|------|
| file | Result contains File object |
| text | Result contains File object and text content |
| Value | Description |
| ------- | ---------------------------------------------- |
| file | Result contains File object |
| text | Result contains File object and text content |
| dataUrl | Result contains File object and base64 content |
### Methods
@@ -212,6 +207,6 @@ export default {
Use [ref](https://vuejs.org/v2/api/#ref) to get Uploader instance and call instance methods
| Name | Description | Attribute | Return value |
|------|------|------|------|
| --- | --- | --- | --- |
| closeImagePreview | Close full screen image preview | - | - |
| chooseFile `v2.5.6` | Trigger choosing files, works with the user action context only because of browser security | - | - |