Skip to content

SearchForm 搜索表单

用于表格上方的搜索筛选表单。

基础用法

vue
<template>
  <x-search-form
    :columns="columns"
    @search="handleSearch"
  />
</template>

<script setup>
import { SearchForm } from '@xto/business'

const columns = [
  { prop: 'name', label: '姓名', type: 'input' },
  { prop: 'status', label: '状态', type: 'select', options: [
    { label: '启用', value: 1 },
    { label: '禁用', value: 0 }
  ]}
]

const handleSearch = (params) => {
  console.log('搜索参数:', params)
}
</script>

API

Props

属性说明类型默认值
columns表单项配置SearchFormItem[][]
model表单数据对象Record<string, any>{}
labelWidth标签宽度string | number'100px'
labelPosition标签位置'left' | 'right' | 'top''right'

SearchFormItem

属性说明类型
prop字段名string
label标签文本string
type输入类型'input' | 'select' | 'date' | 'daterange'
placeholder占位文本string
options选项列表(select 类型){ label: string, value: any }[]
defaultValue默认值any

Events

事件名说明
search搜索时触发
reset重置时触发

基于 MIT 许可发布