diff --git a/demo/components/datePickerDemo.vue b/demo/components/datePickerDemo.vue index a7271302a..b963a74a5 100644 --- a/demo/components/datePickerDemo.vue +++ b/demo/components/datePickerDemo.vue @@ -14,13 +14,66 @@ Basic Usage
+
- timestamp: {{ timestamp }} + dateTimeTimestamp: {{ dateTimeTimestamp }}
- + + +
+ dateTimeStamp: {{ dateTimestamp }} +
+ + + +
- +
@@ -33,10 +86,17 @@ export default { mixins: [docCodeEditorMixin], data () { return { - timestamp: 0 + dateTimeTimestamp: 666666666, + dateTimestamp: null } }, methods: { + onDateTimeChange (timestamp, dateTimeString) { + this.$NMessage.success(`${timestamp}, ${dateTimeString}`) + }, + onDateChange (timestamp, dateString) { + this.$NMessage.success(`${timestamp}, ${dateString}`) + } } } diff --git a/packages/common/DatePicker/src/main.vue b/packages/common/DatePicker/src/main.vue index d5b2c6021..431bbd8c6 100644 --- a/packages/common/DatePicker/src/main.vue +++ b/packages/common/DatePicker/src/main.vue @@ -10,7 +10,7 @@
-
+
+
- {{ calendarTime.startOf('month').format('MMMM') }} {{ calendarTime.year() }} + {{ calendarDateTime.format('MMMM') }} {{ calendarDateTime.year() }}
-.date { - text-align: center; - width: 36px; - opacity: .6; - &.n-date-picker-calendar__date--current { - color: blue; - } - &.n-date-picker-calendar__date--selected { - background-color: red; - } - cursor: pointer; - &.n-date-picker-calendar__date--in-display-month, &.n-date-picker-calendar__date--day { - opacity: 1; - } -} - diff --git a/packages/common/DatePicker/src/utils.js b/packages/common/DatePicker/src/utils.js index a94cefc34..de8e261f6 100644 --- a/packages/common/DatePicker/src/utils.js +++ b/packages/common/DatePicker/src/utils.js @@ -1,7 +1,13 @@ import moment from 'moment' +/** + * change date of `time` accroding to `dateItem` + * keep time of `time` + * return a new Moment Object according to time + * @param {Moment} time + * @param {Object} dateItem + */ function setDate (time, dateItem) { - console.log(time, dateItem) time.year(dateItem.year) time.month(dateItem.month) time.date(dateItem.date) diff --git a/packages/common/Input/src/main.vue b/packages/common/Input/src/main.vue index 5c2b782ae..a94209fee 100644 --- a/packages/common/Input/src/main.vue +++ b/packages/common/Input/src/main.vue @@ -77,7 +77,7 @@ export default { default: '' }, value: { - type: String, + type: [String, Number], default: '' }, disabled: {