Gathering detailed insights and metrics for form-render4-vue3-pro
Gathering detailed insights and metrics for form-render4-vue3-pro
Gathering detailed insights and metrics for form-render4-vue3-pro
Gathering detailed insights and metrics for form-render4-vue3-pro
npm install form-render4-vue3-pro
Typescript
Module System
Node Version
NPM Version
Vue (63.53%)
JavaScript (36.27%)
HTML (0.19%)
Built with Next.js • Fully responsive • SEO optimized • Open source ready
Total Downloads
4,343
Last Day
36
Last Week
49
Last Month
136
Last Year
1,132
MIT License
9 Stars
98 Commits
1 Forks
1 Watchers
4 Branches
1 Contributors
Updated on Feb 24, 2025
Latest Version
3.0.8
Package Id
form-render4-vue3-pro@3.0.8
Unpacked Size
73.21 kB
Size
11.87 kB
File Count
56
NPM Version
10.7.0
Node Version
20.14.0
Published on
Oct 10, 2024
Cumulative downloads
Total Downloads
Last Day
3,500%
36
Compared to previous day
Last Week
512.5%
49
Compared to previous week
Last Month
161.5%
136
Compared to previous month
Last Year
-44.1%
1,132
Compared to previous year
5
4
form-render4-vue3-pro 是基于 vue3 的表单生成组件,组件包含了日常使用的表单组件,意在解决项目日常开发中表单代码重复书写的问题,提高开发效率。
项目目前支持UI库:
- element-plus
- arco-design
npm install form-render4-vue3-pro --save
1// main.js 2import { createApp } from 'vue' 3// import FormRender4Vue3 from 'form-render4-vue3-pro/arco-design' 4import FormRender4Vue3 from 'form-render4-vue3-pro/element-plus' 5import App from './App.vue' 6 7const app = createApp(App) 8app.use(FormRender4Vue3,{ warning:false }) // 安装组件时可选择警告信息打印与否 9app.mount('#app')
1<template> 2 <!-- 你的组件 --> 3 <form-render4-vue3-pro 4 :schema="schema" 5 v-model="formData" 6 :option-data="optionData" 7 /> 8</template> 9 10<script setup> 11import { reactive } from 'vue' 12 13const formData = reactive({}) 14const optionData = reactive({ 15 address: { 16 list: [ 17 { 18 label: '北京', 19 value: 'beijing', 20 }, 21 { 22 label: '上海', 23 value: 'shanghai', 24 }, 25 { 26 label: '深圳', 27 value: 'shenzhen', 28 }, 29 { 30 label: '成都', 31 value: 'chengdu', 32 }, 33 ], 34 key: 'value', 35 }, 36}) 37const schema = reactive({ 38 props: { 39 layout: 'horizontal', 40 labelAlign: 'left', 41 }, 42 fields: [ 43 { 44 type: 'input', 45 title: '姓名', 46 field: 'name', 47 value: '', 48 props: { 49 placeholder: '输入姓名', 50 }, 51 }, 52 { 53 type: 'select', 54 title: '地址', 55 field: 'address', 56 value: '', 57 props: { 58 placeholder: '选择地址', 59 }, 60 }, 61 ], 62}) 63</script>
参数名 | 类型 | 描述 | 是否必须 |
---|---|---|---|
modelValue(v-model) | Object | 表单数据对象 | Yes |
schema | Object | 生成表单的 JSON 对象 | Yes |
optionData | Object | select、checkbox、radio、tree-select、cascader、transfer 等组件选项的数据源 | No |
方法名 | 描述 | 参数 | 返回值 |
---|---|---|---|
validate | 校验表单全部数据 | - | Promise |
clearValidate | 清除校验表单校验数据 | - | - |
reset | 重置表单字段 | -/string[] | void |
插槽名 | 描述 | 参数 | |
---|---|---|---|
footer | 页脚 | - | - |
字段名称 | 类型 | Description | 是否必须 |
---|---|---|---|
fields | Array | 生成表单项的数组 | Yes |
rules | Object | 使用方式参考 arco-design from 表单 rules | No |
props | - | 使用方式参考 arco-design from 表单原生属性 | No |
column | Number | 生成表单项的列数 | Yes |
gutter | Number | 表单项之间的间隔 | No |
字段名称 | 类型 | Description | 是否必须 |
---|---|---|---|
datasource | DataSource | 远程加载数据配置 | Yes |
type | String | 指定生成对应 arco-design 的组件,对应关系见下表 type | Yes |
gutter | Number | 用与表单项之间的间隔 ,该项不设置会自动取全局的 gutter | No |
title | String | 表单项的名称 | Yes |
field | String | 表单项绑定的字段 | Yes |
value | any | 该表表单项的值 | No |
props | Object | 生成最终组件的 props 项,对应 arco-design 组件的 props | No |
span | Number | 该表单项独占的栅格数(默认为 24) | No |
show | Boolean | 控制表单项显示与否,默认为:true | No |
config | Object | a-form-item 组件配置对象,字段参考a-form-item 组件属性 | No |
children | Array | 嵌套表单项 | No |
watcher | Array | 字段联动动作 | No |
type | 对应的 arco-design 组件名 |
---|---|
form-item | 表单项,复杂表单布局可能会使用到 |
input | a-input |
input-number | a-input-number |
checkbox | a-checkbox |
radio | a-radio |
switch | a-switch |
slider | a-slider |
textarea | a-textarea |
rate | a-rate |
upload | a-upload |
time-picker | a-time-picker |
verification-code | a-verification-code |
tree-select | a-tree-select |
date-range-picker | a-date-range-picker |
date-picker | a-date-picker |
cascader | a-cascader |
transfer | a-transfer |
divider | a-divider |
alert | a-alert |
color | a-color |
No vulnerabilities found.