Skip to content

Date

基础用法

创建时间

<template>
  <ai-form ref="formEl" :model="formInfo" :formConfig="formConfig"></ai-form>
</template>

<script setup>
import { reactive, computed } from 'vue'

const formInfo = reactive({
  createTime: '',
})

const formConfig = computed(() => {
  return [
    {
      key: 'createTime',
      label: '创建时间',
      type: 'date',
      model: 'createTime',
      prop: 'createTime',
      required: true,
      dateType: 'date'
    },
  ]
})
</script>

Props

属性说明类型默认值
typedatestring-
key配置列表唯一标识string-
label标签文本string-
model属性名,它可以是属性的路径(如a.b.0)也可以是一个方法,返回属性路径,该属性是必填的string/Function-
prop一般和属性名保持一致,在使用了validateresetFields的方法时,该属性是必填的string/Function-
width宽度(1-24)number12
noneLabel是否隐藏标签booleanfalse
placeholder输入框占位文本string-
disabled是否禁用boolean/Functionfalse
size输入框尺寸string-
required是否必填booleanfalse
readonly只读booleanfalse
startPlaceholder开始时间框占位文本string-
endPlaceholder结束时间框占位文本string-
dateType时间类型stringdate
teleported弹层是否使用teleportbooleantrue
defaultValue可选,选择器打开时默认显示的时间object-
defaultTime范围选择时选中日期所使用的当日内具体时刻object-
format显示在输入框中的格式stringYYYY-MM-DD
valueFormat可选,绑定值的格式。 不指定则绑定值为 Date 对象object-
disabledDate一个用来判断该日期是否被禁用的函数,应该返回一个BooleanFunction-
clearable是否显示清除按钮booleanfalse
shortcuts设置快捷选项,需要传入数组对象array[]
showErrorTooltip是否展示错误提示booleantrue
changeFun当绑定值变化时触发的回调函数Function-
showFun是否展示的判断函数,返回一个booleanFunction-