Compare commits

...

4 Commits

Author SHA1 Message Date
neverland
1fd630a9d2
fix(FIeld): field-error-message-font-size var name (#9393) 2021-09-03 15:24:09 +08:00
neverland
76e8e62efd
chore: remove console (#9390) 2021-09-03 15:07:59 +08:00
chenjiahan
1167293d12 chore: release 2.12.27-beta.0 2021-09-03 15:01:44 +08:00
neverland
a69385d867
feat(Sku): add custom-upload prop (#9389) 2021-09-03 15:00:20 +08:00
8 changed files with 27 additions and 6 deletions

View File

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

View File

@ -307,7 +307,7 @@ How to use: [Custom Theme](#/en-US/theme).
| @field-clear-icon-color | `@gray-5` | - |
| @field-right-icon-color | `@gray-6` | - |
| @field-error-message-color | `@red` | - |
| @field-error-message-text-color | `12px` | - |
| @field-error-message-font-size | `12px` | - |
| @field-text-area-min-height | `60px` | - |
| @field-word-limit-color | `@gray-7` | - |
| @field-word-limit-font-size | `@font-size-sm` | - |

View File

@ -332,7 +332,7 @@ export default {
| @field-clear-icon-color | `@gray-5` | - |
| @field-right-icon-color | `@gray-6` | - |
| @field-error-message-color | `@red` | - |
| @field-error-message-text-color | `12px` | - |
| @field-error-message-font-size | `12px` | - |
| @field-text-area-min-height | `60px` | - |
| @field-word-limit-color | `@gray-7` | - |
| @field-word-limit-font-size | `@font-size-sm` | - |

View File

@ -134,7 +134,7 @@
&__error-message {
color: @field-error-message-color;
font-size: @field-error-message-text-color;
font-size: @field-error-message-font-size;
text-align: left;
&--center {

View File

@ -340,6 +340,14 @@ messageConfig: {
setTimeout(() => resolve('https://img01.yzcdn.cn/upload_files/2017/02/21/FjKTOxjVgnUuPmHJRdunvYky9OHP.jpg!100x100.jpg'), 1000);
});
},
// 可选项,自定义图片上传逻辑,使用此选项时,会禁用原生图片选择
customUpload: () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve('https://img01.yzcdn.cn/vant/leaf.jpg');
}, 1000);
});
},
// 最大上传体积 (MB)
uploadMaxSize: 3,
// placeholder 配置

View File

@ -12,6 +12,7 @@ export default createComponent({
props: {
value: String,
uploadImg: Function,
customUpload: Function,
maxSize: {
type: Number,
default: 6,
@ -56,6 +57,15 @@ export default createComponent({
onDelete() {
this.$emit('input', '');
},
onClickUpload() {
if (this.customUpload) {
this.customUpload().then((url) => {
this.fileList.push({ url });
this.$emit('input', url);
});
}
},
},
render() {
@ -63,10 +73,12 @@ export default createComponent({
<Uploader
vModel={this.fileList}
maxCount={1}
afterRead={this.afterReadFile}
readonly={!!this.customUpload}
maxSize={this.maxSize * 1024 * 1024}
afterRead={this.afterReadFile}
onOversize={this.onOversize}
onDelete={this.onDelete}
onClick-upload={this.onClickUpload}
/>
);
},

View File

@ -141,6 +141,7 @@ export default createComponent({
vModel={this.messageValues[index].value}
maxSize={this.messageConfig.uploadMaxSize}
uploadImg={this.messageConfig.uploadImg}
customUpload={this.messageConfig.customUpload}
/>
<div class={bem('image-cell-label')}>{t('imageLabel')}</div>
</Cell>

View File

@ -397,7 +397,7 @@
@field-clear-icon-color: @gray-5;
@field-right-icon-color: @gray-6;
@field-error-message-color: @red;
@field-error-message-text-color: 12px;
@field-error-message-font-size: 12px;
@field-text-area-min-height: 60px;
@field-word-limit-color: @gray-7;
@field-word-limit-font-size: @font-size-sm;