naive-ui/demo/documentation/components/datePicker/zhCN/disabled.md
2020-02-04 19:05:59 +08:00

951 B

禁用

<n-date-picker
  v-model="datetime"
  type="datetime"
  :disabled="disabled"
  @change="onDateTimeChange"
/>
<n-date-picker
  v-model="datetime"
  type="date"
  :disabled="disabled"
  @change="onDateChange"
/>
<n-date-picker
  v-model="datetimerange"
  :disabled="disabled"
  type="datetimerange"
/>
<n-date-picker v-model="daterange" :disabled="disabled" type="daterange" />
<n-switch v-model="disabled" />
export default {
  data() {
    return {
      datetime: 891360258000,
      date: null,
      datetimerange: [324910284, 910391323],
      daterange: [324910284, 910391323],
      disabled: true
    };
  },
  methods: {
    onDateTimeChange(timestamp, dateTimeString) {
      this.$NMessage.success(`${timestamp}, ${dateTimeString}`);
    },
    onDateChange(timestamp, dateString) {
      this.$NMessage.success(`${timestamp}, ${dateString}`);
    }
  }
};
.n-date-picker {
  margin: 0 12px 8px 0;
}