From a47c6ef75bd6a4e52d9e56aa91f00c56f3d9ddf6 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 27 Dec 2018 22:14:32 +0800 Subject: [PATCH 01/63] feat: add multiFormats --- components/_util/BaseMixin.js | 28 ++--- components/vc-calendar/demo/antd-calendar.vue | 38 +++++- components/vc-calendar/index.js | 2 +- components/vc-calendar/src/Calendar.jsx | 6 +- components/vc-calendar/src/date/DateInput.jsx | 112 ++++++++++-------- components/vc-calendar/src/locale/it_IT.js | 14 +-- components/vc-calendar/src/util/index.js | 12 ++ 7 files changed, 140 insertions(+), 72 deletions(-) diff --git a/components/_util/BaseMixin.js b/components/_util/BaseMixin.js index 1897d3cfec..f01a6b5e3e 100644 --- a/components/_util/BaseMixin.js +++ b/components/_util/BaseMixin.js @@ -1,21 +1,21 @@ export default { - directives: { - ref: { - bind: function (el, binding, vnode) { - binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) - }, - update: function (el, binding, vnode) { - binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) - }, - unbind: function (el, binding, vnode) { - binding.value(null) - }, - }, - }, + // directives: { + // ref: { + // bind: function (el, binding, vnode) { + // binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) + // }, + // update: function (el, binding, vnode) { + // binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) + // }, + // unbind: function (el, binding, vnode) { + // binding.value(null) + // }, + // }, + // }, methods: { setState (state, callback) { - const newState = typeof state === 'function' ? state(this.$data) : state + const newState = typeof state === 'function' ? state(this.$data, this.$props) : state // if (this.getDerivedStateFromProps) { // Object.assign(newState, this.getDerivedStateFromProps(getOptionProps(this), { ...this.$data, ...newState }, true) || {}) // } diff --git a/components/vc-calendar/demo/antd-calendar.vue b/components/vc-calendar/demo/antd-calendar.vue index aef18638aa..edc45f6238 100644 --- a/components/vc-calendar/demo/antd-calendar.vue +++ b/components/vc-calendar/demo/antd-calendar.vue @@ -183,6 +183,39 @@ const Demo = { }, } +const multiFormats = ['DD/MM/YYYY', 'DD/MM/YY', 'DDMMYY', 'D/M/YY'] + +const DemoMultiFormat = { + data: () => ({ + value: now, + }), + methods: { + onChange (value) { + console.log('Calendar change: ', (value && value.format(format))) + this.value = value + }, + }, + + render () { + const state = this.$data + return (
We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.
+{{item.content}}
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.
We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.
{{item.content}}
-We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
-We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
-We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).
We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.
++- Reply to
+
+We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.
++- Reply to
+
+