diff --git a/src/form/README.md b/src/form/README.md
index 2ffa830bb..7ac282785 100644
--- a/src/form/README.md
+++ b/src/form/README.md
@@ -212,7 +212,7 @@ export default {
show-toolbar
:columns="columns"
@confirm="onConfirm"
- @cancel="onCancel"
+ @cancel="showPicker = false"
/>
```
@@ -231,9 +231,6 @@ export default {
this.value = value;
this.showPicker = false;
},
- onCancel() {
- this.showPicker = false;
- },
},
};
```
@@ -252,10 +249,9 @@ export default {
/>
```
@@ -266,18 +262,11 @@ export default {
return {
value: '',
showPicker: false,
- currentDate: new Date(),
};
},
methods: {
- formatDate(date) {
- return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
- },
- onConfirm(date) {
- this.value = this.formatDate(date);
- this.showPicker = false;
- },
- onCancel() {
+ onConfirm(time) {
+ this.value = time;
this.showPicker = false;
},
},
@@ -300,7 +289,7 @@ export default {
```
@@ -319,8 +308,37 @@ export default {
this.value = values.map(item => item.name).join('/');
this.showArea = false;
},
- onCancel() {
- this.showArea = false;
+ },
+};
+```
+
+### Field Type - Calendar
+
+```html
+
+
+```
+
+```js
+export default {
+ data() {
+ return {
+ value: '',
+ showCalendar: false,
+ };
+ },
+ methods: {
+ onConfirm(date) {
+ this.value = `${date.getMonth() + 1}/${date.getDate()}`;
+ this.showCalendar = false;
},
},
};
diff --git a/src/form/README.zh-CN.md b/src/form/README.zh-CN.md
index b1f85de37..7c2994c19 100644
--- a/src/form/README.zh-CN.md
+++ b/src/form/README.zh-CN.md
@@ -218,7 +218,7 @@ export default {
show-toolbar
:columns="columns"
@confirm="onConfirm"
- @cancel="onCancel"
+ @cancel="showPicker = false"
/>
```
@@ -237,9 +237,6 @@ export default {
this.value = value;
this.showPicker = false;
},
- onCancel() {
- this.showPicker = false;
- },
},
};
```
@@ -258,10 +255,9 @@ export default {
/>
```
@@ -272,18 +268,11 @@ export default {
return {
value: '',
showPicker: false,
- currentDate: new Date(),
};
},
methods: {
- formatDate(date) {
- return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
- },
- onConfirm(date) {
- this.value = this.formatDate(date);
- this.showPicker = false;
- },
- onCancel() {
+ onConfirm(time) {
+ this.value = time;
this.showPicker = false;
},
},
@@ -306,7 +295,7 @@ export default {
```
@@ -317,7 +306,7 @@ export default {
return {
value: '',
showArea: false,
- areaList: {} // 数据格式见 Area 组件文档
+ areaList: {}, // 数据格式见 Area 组件文档
};
},
methods: {
@@ -325,8 +314,37 @@ export default {
this.value = values.map(item => item.name).join('/');
this.showArea = false;
},
- onCancel() {
- this.showArea = false;
+ },
+};
+```
+
+### 表单项类型 - 日历
+
+```html
+
+
+```
+
+```js
+export default {
+ data() {
+ return {
+ value: '',
+ showCalendar: false,
+ };
+ },
+ methods: {
+ onConfirm(date) {
+ this.value = `${date.getMonth() + 1}/${date.getDate()}`;
+ this.showCalendar = false;
},
},
};
diff --git a/src/form/demo/FieldType.vue b/src/form/demo/FieldType.vue
index 3d74062ac..ae7549f64 100644
--- a/src/form/demo/FieldType.vue
+++ b/src/form/demo/FieldType.vue
@@ -50,6 +50,7 @@
+
{{ $t('submit') }}
@@ -61,6 +62,7 @@
diff --git a/src/form/demo/FieldTypeDatetimePicker.vue b/src/form/demo/FieldTypeDatetimePicker.vue
index eb5dfd0f9..2ec061c9d 100644
--- a/src/form/demo/FieldTypeDatetimePicker.vue
+++ b/src/form/demo/FieldTypeDatetimePicker.vue
@@ -11,8 +11,7 @@
/>
@@ -37,16 +36,13 @@ export default {
return {
value: '',
showPicker: false,
- currentDate: new Date(),
};
},
methods: {
- formatDate(date) {
- return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
- },
- onConfirm(date) {
- this.value = this.formatDate(date);
+ onConfirm(time) {
+ console.log('time', time);
+ this.value = time;
this.showPicker = false;
},
onCancel() {
diff --git a/src/form/test/__snapshots__/demo.spec.js.snap b/src/form/test/__snapshots__/demo.spec.js.snap
index be11280fb..7f37ab9de 100644
--- a/src/form/test/__snapshots__/demo.spec.js.snap
+++ b/src/form/test/__snapshots__/demo.spec.js.snap
@@ -184,6 +184,15 @@ exports[`renders demo correctly 1`] = `
+