DatePickerPanel
Date panel without an input box
Suitable for embedding an inline panel or custom popup layout inside a form. It exposes the same props as DatePicker and automatically applies the same default format / valueFormat, so you get consistent string values without additional configuration.
Markup Schema Example
<script lang="ts" setup>
import { createForm } from '@silver-formily/core'
import { DatePickerPanel, Form, FormItem, Submit } from '@silver-formily/element-plus'
import { createSchemaField } from '@silver-formily/vue'
const form = createForm()
const { SchemaField, SchemaStringField, SchemaArrayField } = createSchemaField({
components: {
FormItem,
DatePickerPanel,
},
})
async function onSubmit(value: Record<string, any>) {
console.log(value)
}
</script>
<template>
<Form :form="form" layout="vertical">
<SchemaField>
<SchemaStringField
name="inlineDate"
title="Inline Date"
x-decorator="FormItem"
x-component="DatePickerPanel"
:x-component-props="{ style: 'width: 340px' }"
/>
<SchemaArrayField
name="inlineRange"
title="Inline Range"
x-decorator="FormItem"
x-component="DatePickerPanel"
:x-component-props="{
type: 'daterange',
style: 'width: 540px',
}"
/>
</SchemaField>
<Submit style="margin-top: 12px" @submit="onSubmit">
Submit
</Submit>
</Form>
</template>查看源码
Template Example
<script lang="ts" setup>
import { createForm } from '@silver-formily/core'
import { DatePickerPanel, Form, FormItem, Submit } from '@silver-formily/element-plus'
import { ArrayField, Field } from '@silver-formily/vue'
const form = createForm()
async function onSubmit(value: Record<string, any>) {
console.log(value)
}
</script>
<template>
<Form :form="form" layout="vertical">
<Field
name="inlineDate"
title="Inline Date"
:decorator="[FormItem]"
:component="[
DatePickerPanel,
{
style: 'width: 340px',
},
]"
/>
<ArrayField
name="inlineRange"
title="Inline Range"
:decorator="[FormItem]"
:component="[
DatePickerPanel,
{
type: 'daterange',
style: 'width: 540px',
},
]"
/>
<Submit style="margin-top: 12px" @submit="onSubmit">
Submit
</Submit>
</Form>
</template>查看源码
API
See https://element-plus.org/en-US/component/date-picker.html#date-picker-panel