Compare commits

...

4 Commits

Author SHA1 Message Date
chenjiahan
4f2fda84fa docs(changelog): 2.12.26 2021-08-15 09:41:34 +08:00
chenjiahan
72976d0ea2 chore: release 2.12.26 2021-08-15 09:39:57 +08:00
neverland
8aa2c14cbc
feat(Uploader): add click-upload event (#9260) 2021-08-15 09:37:13 +08:00
neverland
ee40d1e974
feat(Uploader): add readonly prop (#9257) 2021-08-14 09:16:16 +08:00
7 changed files with 61 additions and 10 deletions

View File

@ -16,6 +16,21 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details
### [v2.12.26](https://github.com/youzan/vant/compare/v2.12.25...v2.12.26)
`2021-08-15`
**Feature**
- Uploader: add click-upload event [#9260](https://github.com/youzan/vant/issues/9260)
- Uploader: add readonly prop [#9257](https://github.com/youzan/vant/issues/9257)
**Bug Fixes**
- Field: textarea scroll to top after resizing [#9207](https://github.com/youzan/vant/issues/9207)
- Rate: should enable flex wrap [#9193](https://github.com/youzan/vant/issues/9193)
- Tabs: remove invalid head padding for card type [#9169](https://github.com/youzan/vant/issues/9169)
### [v2.12.25](https://github.com/youzan/vant/compare/v2.12.24...v2.12.25)
`2021-07-25`

View File

@ -16,6 +16,21 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
## 更新内容
### [v2.12.26](https://github.com/youzan/vant/compare/v2.12.25...v2.12.26)
`2021-08-15`
**Feature**
- Uploader: 新增 click-upload 事件 [#9260](https://github.com/youzan/vant/issues/9260)
- Uploader: 新增 readonly 属性 [#9257](https://github.com/youzan/vant/issues/9257)
**Bug Fixes**
- Field: 修复 Textarea 内容较多时,输入会导致页面滚动到顶部的问题 [#9207](https://github.com/youzan/vant/issues/9207)
- Rate: 修复星星较多时无法自动换行的问题 [#9193](https://github.com/youzan/vant/issues/9193)
- Tabs: 修复 card 类型内边距错误的问题 [#9169](https://github.com/youzan/vant/issues/9169)
### [v2.12.25](https://github.com/youzan/vant/compare/v2.12.24...v2.12.25)
`2021-07-25`

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "2.12.25",
"version": "2.12.26",
"description": "Mobile UI Components built on Vue",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -258,6 +258,7 @@ export default {
| preview-options `v2.9.3` | Options of full screen image previewsee [ImagePreview](#/en-US/image-preview) | _object_ | - |
| multiple | Whether to enable multiple selection pictures | _boolean_ | `false` |
| disabled | Whether to disabled the upload | _boolean_ | `false` |
| readonly `v2.12.26` | Whether to make upload area readonly | _boolean_ | `false` |
| deletable | Whether to show delete icon | _boolean_ | `true` |
| show-upload `v2.5.6` | Whether to show upload area | _boolean_ | `true` |
| lazy-load `v2.6.2` | Whether to enable lazy loadshould register [Lazyload](#/en-US/lazyload) component | _boolean_ | `false` |
@ -279,6 +280,7 @@ export default {
| Event | Description | Arguments |
| --- | --- | --- |
| oversize | Emitted when file size over limit | Same as after-read |
| click-upload `v2.12.26` | Emitted when click upload area | _event: MouseEvent_ |
| click-preview | Emitted when preview image is clicked | Same as after-read |
| close-preview | Emitted when the full screen image preview is closed | - |
| delete | Emitted when preview file is deleted | Same as after-read |

View File

@ -288,6 +288,7 @@ export default {
| preview-options `v2.9.3` | 全屏图片预览的配置项,可选值见 [ImagePreview](#/zh-CN/image-preview) | _object_ | - |
| multiple | 是否开启图片多选,部分安卓机型不支持 | _boolean_ | `false` |
| disabled | 是否禁用文件上传 | _boolean_ | `false` |
| readonly `v2.12.26` | 是否将上传区域设置为只读状态 | _boolean_ | `false` |
| deletable | 是否展示删除按钮 | _boolean_ | `true` |
| show-upload `v2.5.6` | 是否展示上传区域 | _boolean_ | `true` |
| lazy-load `v2.6.2` | 是否开启图片懒加载,须配合 [Lazyload](#/zh-CN/lazyload) 组件使用 | _boolean_ | `false` |
@ -306,12 +307,13 @@ export default {
### Events
| 事件名 | 说明 | 回调参数 |
| ------------- | ---------------------- | --------------- |
| oversize | 文件大小超过限制时触发 | 同 `after-read` |
| click-preview | 点击预览图时触发 | 同 `after-read` |
| close-preview | 关闭全屏图片预览时触发 | - |
| delete | 删除文件预览时触发 | 同 `after-read` |
| 事件名 | 说明 | 回调参数 |
| ----------------------- | ---------------------- | ------------------- |
| oversize | 文件大小超过限制时触发 | 同 `after-read` |
| click-upload `v2.12.26` | 点击上传区域时触发 | _event: MouseEvent_ |
| click-preview | 点击预览图时触发 | 同 `after-read` |
| close-preview | 关闭全屏图片预览时触发 | - |
| delete | 删除文件预览时触发 | 同 `after-read` |
### Slots

View File

@ -24,6 +24,7 @@ export default createComponent({
props: {
disabled: Boolean,
readonly: Boolean,
lazyLoad: Boolean,
uploadText: String,
afterRead: Function,
@ -248,6 +249,10 @@ export default createComponent({
}
},
onClickUpload(event) {
this.$emit('click-upload', event);
},
onPreviewImage(item) {
if (!this.previewFullImage) {
return;
@ -391,7 +396,7 @@ export default createComponent({
const slot = this.slots();
const Input = (
const Input = this.readonly ? null : (
<input
{...{ attrs: this.$attrs }}
ref="input"
@ -405,7 +410,11 @@ export default createComponent({
if (slot) {
return (
<div class={bem('input-wrapper')} key="input-wrapper">
<div
class={bem('input-wrapper')}
key="input-wrapper"
onClick={this.onClickUpload}
>
{slot}
{Input}
</div>
@ -422,7 +431,11 @@ export default createComponent({
}
return (
<div class={bem('upload')} style={style}>
<div
class={bem('upload', { readonly: this.readonly })}
style={style}
onClick={this.onClickUpload}
>
<Icon name={this.uploadIcon} class={bem('upload-icon')} />
{this.uploadText && (
<span class={bem('upload-text')}>{this.uploadText}</span>

View File

@ -48,6 +48,10 @@
background-color: @uploader-upload-active-color;
}
&--readonly:active {
background-color: @uploader-upload-background-color;
}
&-icon {
color: @uploader-icon-color;
font-size: @uploader-icon-size;