Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ant-design-vue/pro-form

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ant-design-vue/pro-form

Ant Design Pro Form of Vue, easy to use pro scaffolding.

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Ant Design Pro Form

NPM version Vue Support Vue Grammar Level NPM downloads License

## Basic Usage

Recommend look Examples

Branch

Install

# yarn
yarn add @ant-design-vue/pro-form
# npm
npm i @ant-design-vue/pro-form -S

Simple Usage

// main.[js|ts]
import "@ant-design-vue/pro-form/dist/style.css"; // pro-form css or style.less
<template>
  <QueryFilter
    :model="formModel"
    @finish="handleSubmit"
    @collapsed="onCollapsed"
  >
    <FormItem name="name" label="应用名称" required>
      <Input v-model:value="formModel.name" placeholder="请输入" allow-clear />
    </FormItem>
    <FormItem name="creater" label="创建人" required>
      <Input v-model:value="formModel.creater" placeholder="请输入" />
    </FormItem>
    <FormItem name="sex" label="性别" required>
      <Select v-model:value="formModel.sex">
        <SelectOption
          v-for="item in sex"
          :key="item.value"
          :value="item.value"
          >{{ item.label }}</SelectOption
        >
      </Select>
    </FormItem>
    <FormItem name="status" label="应用状态">
      <Input v-model:value="formModel.status" placeholder="请输入" />
    </FormItem>
    <FormItem name="startDate" label="响应日期">
      <DatePicker v-model:value="formModel.startDate" placeholder="请输入" />
    </FormItem>
    <FormItem name="create" label="创建时间">
      <RangePicker
        v-model:value="formModel.create"
        :placeholder="['开始时间', '结束时间']"
      />
    </FormItem>
  </QueryFilter>
</template>

<script lang="ts" setup>
import { ref, reactive } from "vue";
import { QueryFilter } from "@ant-design-vue/pro-form";
import dayjs, { type Dayjs } from "dayjs";
import {
  FormItem,
  Input,
  Select,
  SelectOption,
  RangePicker,
  DatePicker,
} from "ant-design-vue";

const formModel = reactive({
  name: "123",
  creater: "11",
  sex: "男",
  status: "",
  startDate: "",
  create: [
    dayjs("2015/01/01", "YYYY/MM/DD"),
    dayjs("2016/01/01", "YYYY/MM/DD"),
  ] as [Dayjs, Dayjs],
});
const sex = ref([
  {
    value: "男",
    label: "男",
  },
  {
    value: "女",
    label: "女",
  },
]);

function handleSubmit(params: any) {
  console.log(params);
}
function onCollapsed(collapsed: boolean) {
  console.log(collapsed);
}
</script>

API

ProLayout

PropertyDescriptionTypeDefault Value
formPropsantd 基础表单 propsobject
searchGutter表单 gutternumber24
style自定义样式objectundefined
defaultColsNumber自定义折叠状态下默认显示的表单控件数量,没有设置或小于 0,则显示一行控件; 数量大于等于控件数量则隐藏展开按钮Numberundefined
collapsed是否折叠超出的表单项,用于受控模式Booleanundefined
defaultCollapsed默认状态下是否折叠超出的表单项Booleantrue
preserve是否能够查询收起的数据,如果设置为 false,收起后的表单数据将会丢失Booleantrue
split每一行是否有分割线Booleanundefined
submitButtonProps提交按钮的 propsObjectundefined
submitter重置、查询、展开收起按钮 propsSubmitterPropsundefined
onCollapsed切换表单折叠状态时的回调(collapsed: boolean) => voidundefined
onFinish表单提交(fromModel: any) => voidundefined
onSubmit表单提交(fromModel: any) => voidundefined
onReset重置表单(fromModel: any) => voidundefined

Build project

pnpm build # Build library and .d.ts

TODO:

  • BaseFrom
  • QueryFilter
  • ProForm
    • ProField
    • 更多原子组件...
  • LoginFrom
  • ModalFrom
  • DrawerFrom
  • ProTable
  • 一个像样的文档(VitePress)

FAQs

Package last updated on 04 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc