Skip to content

Hyb-Naive对NaiveUI表单组件进行二次封装

简单、快速实现表单的录入和页面筛选器

logo

快速开始

sh
npm install hyb-naive
sh
pnpm install hyb-naive
sh
yarn add hyb-naive

快速实现一个筛选器

vue
<template>
  <HForm type="FILTER" card :rules="filterRules" @search="search" /> 
</template>

<script setup lang='ts'> 
import { HForm } from 'hyb-naive' // 确保HForm组件已正确引入

const filterRules = [
  {
    field: 'category',
    compType: 'Select',
    label: '项目类别',
    options: [
      { label: '项目1', value: '1' },
      { label: '项目2', value: '2' },
    ],
  },
  {
    field: 'projectName',
    compType: 'Input',
    label: '项目名称',
  },
  {
    label: '操作时间',
    field: 'time',
    compType: 'DatePicker',
    fullWidth: true,
    props: {
      type: 'datetimerange',
    },
  },
]

// 搜索
function search(searchParams) {
  console.log('searchParams', searchParams)
}
</script>

Released under the MIT License.