You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/date-picker/demo/text.vue

41 lines
928 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<docs>
---
order: 12
title:
zh-CN: 自定义渲染
en-US: Custum Time
---
## zh-CN
增加自定义渲染功能在默认 `slot` 你可以设置任何你想渲染的组件
## en-US
Added custom rendering function, in the default `slot`, you can set any component you want to render.
</docs>
<template>
<a-space direction="vertical" :size="12">
<a-date-picker v-model:value="time1" placeholder="Select Time" @ok="onOk">
<span>{{ time1 ? time1.toString() : 'SelectTime' }}</span>
</a-date-picker>
<a-range-picker v-model:value="time2">
<span>
{{ time2 ? time2.toString() : '请选择' }}
</span>
</a-range-picker>
</a-space>
</template>
<script lang="ts" setup>
import { Dayjs } from 'dayjs';
import { ref } from 'vue';
const time1 = ref<Dayjs>();
const time2 = ref<[Dayjs, Dayjs]>();
const onOk = (value: Dayjs) => {
console.log('onOk: ', value);
};
</script>