更新记录
1.0.4(2025-08-15)
修复bug
1.0.3(2025-08-07)
增加slider控件
1.0.2(2025-08-07)
增加DataSelect控件
查看更多
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
√ |
√ |
√ |
√ |
- |
- |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
√ |
√ |
√ |
√ |
- |
- |
- |
√ |
- |
- |
- |
其他
next-forms --低代码表单
请使用源码授权版,普通授权版的插件被官方进行加密,加密后插件有问题,如果试用源码授权版有任何问题可以*** : 455-948-571
遇到问题或有建议可以加入1已满>(455948571)反馈qQ : 455-948-571
遇到问题或有建议可以加入2(578935043)反馈qQ : 578-935-043
如果觉得组件不错,给五星鼓励鼓励咯!
注意
作者不介意你对组件源码进行改造使用,为了开源更加高效,谢谢你的配合;为了节省不必要的沟通浪费,以下情况请不要再反馈给作者,请自行解决;
在这感各位的理解,我支持开源,但是作者时间有限;谢谢各位的配合;在这里期望我写的小小插件能为你提供便捷;
1.如果你对源码进行了修改使用,请不需要对作者做任何的反馈,作者确实没有空陪你做技术分析解答;
2.如果你引入插件,连插件是否有正常被uniapp框架识别解析都不清楚,请你换个插件使用;
3.如果你引入插件,针对自己项目进行功能改造的,请自行仔细阅读源码并了解其原理,自行改造;这里作者不愿意浪费过多时间进行技术解答;
4.如果你不想进行全局加载next-tree,需要按需加载;next-tree中有相关依赖的组件,需要你自行在组件内部单独引入;依赖组件可以在package.json中找到;
5.理论上作者不再解决由于本地开发环境问题所导致的插件使用问题,请自行到uniapp官网学习解决;
关注作者的动态
点击进入主页,关注作者
关注作者其他开源
npm开源包:npm;
github:github;
使用demo使用提示:
使用demo;在下载的源码中存在一个userDemo的文件目录,里面有vue2和vue3的使用demo。
插件内有字体文件源文件,如果需要私域部署的请自行部署并更新style.css里面的引用路径即可。
<template>
<next-forms
primaryColor="#ed7d31"
validateTrigger="bind"
labelPosition="left"
labelAlign="left"
labelWidth="180rpx"
:border="false"
:schemas="schemas"
>
<template #compSlotA="{field, formModel}">
<u-input type="text" v-model="formModel[field]" placeholder="请输入年龄" />
</template>
</next-forms>
</template>
vue3 + ts 使用
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { ref, unref } from "vue";
const reader = ref(false);
const schemas = ref([
{
label: "姓名",
field: "name",
component: 'Input',
componentProps: {
},
rules:[
// 校验 name 不能为空
{
required: true,
errorMessage: '请填写姓名',
},
// 对name字段进行长度验证
{
minLength: 3,
maxLength: 5,
errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符',
}
]
},
{
label: "密码",
field: "password",
required: true,
component: 'Input',
componentProps: {
type: 'password',
}
},
{
label: "手机号码",
field: "phone",
required: true,
component: 'Input',
defaultValue: '***',
componentProps: {
type: 'number'
}
},
{
label: "说明",
field: "remark",
required: true,
component: 'Input',
componentProps: {
type: 'textarea',
clearable: true
}
},
{
label: "来源",
field: "resoure",
required: false,
component: 'DataCheckbox',
defaultValue: 3,
componentProps: {
mode: 'default',
multiple: false,
localdata: [
{
text: '腾讯',
value: 1
},
{
text: '阿里',
value: 2
},
{
text: '京东',
value: 3
},
// {
// text: '百度',
// value: 4
// },
// {
// text: '鑫泽',
// value: 6
// },
// {
// text: '抖音',
// value: 7
// },
]
}
},
{
label: "其他",
field: "other",
required: true,
componentSlot: 'compSlotA',
defaultValue: 34234,
rules:[
// 校验 name 不能为空
{
required: true,
errorMessage: '请填写其他',
}
],
}
]);
const formRef = ref()
const formData = ref({
name: '',
age: ''
})
const rules = ref({
// 对name字段进行必填验证
name: {
// name 字段的校验规则
rules:[
// 校验 name 不能为空
{
required: true,
errorMessage: '请填写姓名',
},
// 对name字段进行长度验证
{
minLength: 3,
maxLength: 5,
errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符',
}
],
// 当前表单域的字段中文名,可不填写
label:'姓名',
validateTrigger:'submit'
}
})
function submit() {
unref(formRef).validate().then(res => {
console.log(11111111, res);
console.log(333333333, unref(formData));
})
}
onShow(() => {
setTimeout(() => {
reader.value = true;
}, 2000)
})
</script>
<style lang="scss">
</style>
vue2 使用
<template>
<next-forms
primaryColor="#ed7d31"
validateTrigger="bind"
labelPosition="left"
labelAlign="left"
labelWidth="180rpx"
:border="false"
:schemas="schemas"
>
<template #compSlotA="{field, formModel}">
<u-input type="text" v-model="formModel[field]" placeholder="请输入年龄" />
</template>
</next-forms>
</template>
<script>
export default {
data () {
return {
rules: {
// 对name字段进行必填验证
name: {
// name 字段的校验规则
rules:[
// 校验 name 不能为空
{
required: true,
errorMessage: '请填写姓名',
},
// 对name字段进行长度验证
{
minLength: 3,
maxLength: 5,
errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符',
}
],
// 当前表单域的字段中文名,可不填写
label:'姓名',
validateTrigger:'submit'
}
},
formData: {},
schemas: [
{
label: "姓名",
field: "name",
component: 'Input',
componentProps: {
},
rules:[
// 校验 name 不能为空
{
required: true,
errorMessage: '请填写姓名',
},
// 对name字段进行长度验证
{
minLength: 3,
maxLength: 5,
errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符',
}
]
},
{
label: "密码",
field: "password",
required: true,
component: 'Input',
componentProps: {
type: 'password',
}
},
{
label: "手机号码",
field: "phone",
required: true,
component: 'Input',
defaultValue: '***',
componentProps: {
type: 'number'
}
},
{
label: "说明",
field: "remark",
required: true,
component: 'Input',
componentProps: {
type: 'textarea',
clearable: true
}
},
{
label: "来源",
field: "resoure",
required: false,
component: 'DataCheckbox',
defaultValue: 3,
componentProps: {
mode: 'default',
multiple: false,
localdata: [
{
text: '腾讯',
value: 1
},
{
text: '阿里',
value: 2
},
{
text: '京东',
value: 3
},
// {
// text: '百度',
// value: 4
// },
// {
// text: '鑫泽',
// value: 6
// },
// {
// text: '抖音',
// value: 7
// },
]
}
},
{
label: "其他",
field: "other",
required: true,
componentSlot: 'compSlotA',
defaultValue: 34234,
rules:[
// 校验 name 不能为空
{
required: true,
errorMessage: '请填写其他',
}
],
}
]
}
},
methods: {
},
created() {
}
}
</script>
<style lang="scss">
.line-block {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
.img {
width: 40rpx;
height: 40rpx;
border-radius: 10rpx;
margin: 0 20rpx;
}
}
</style>
参数
本插件测试支持uni-app,uni-app X, vue2/vue3, app平台, 微信小程序, H5等;
next-forms props说明
参数名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
schemas |
schemas配置见下面说明 |
Array |
是 |
[] |
- |
validateTrigger |
表单校验时机 |
String |
否 |
submit |
bind/submit/blur |
label-position |
label 位置 |
String |
否 |
left |
top/left |
label-width |
label 宽度,单位 px |
String/Number |
否 |
75 |
- |
label-align |
label 居中方式 |
String |
否 |
left |
left/center/right |
err-show-type |
表单错误信息提示方式 |
String |
否 |
undertext |
undertext/toast/modal |
border |
是否显示分格线 |
Boolean |
否 |
false |
true/false |
primaryColor |
表单的主题颜色 |
String |
否 |
#2979ff |
- |
schemas配置说明
schema [] 列描述数据对象,是 schemas 中的一项。
schema props
参数名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
label |
列头显示文字 |
String |
是 |
- |
- |
field |
列数据在数据项中对应的关键key |
String |
是 |
- |
- |
show |
是否显示;该项配置只控制ui视图的显示,但是绑定的model值会依然存在 |
Boolean |
否 |
true |
true/false |
ifShow |
是否显示;该项配置不单是控制ui视图的显示,同样绑定的model值是否存在 |
Functioon/Boolean |
否 |
- |
- |
component |
绑定控件(内置控件说明见下面说明) |
String |
是 |
- |
- |
componentSlot |
绑定控件的插槽配置(优先级大于component的配置) |
String |
否 |
- |
- |
slot |
插槽配置 |
String |
否 |
- |
- |
componentProps |
绑定控件的props |
Functioon/Boolean |
否 |
- |
- |
required |
是否必填(该项设置会自动增加*提示) |
Boolean |
否 |
- |
- |
defaultValue |
默认值配置 |
- |
否 |
- |
- |
rules |
校验规制配置 |
Array |
否 |
- |
- |
component: Input(Input控件说明)
属性名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
type |
输入框的类型 |
String |
否 |
text |
text/textarea/password/number/idcard/digit |
clearable |
是否显示右侧清空内容的图标控件,点击可清空输入框内容(默认true) |
Boolean |
否 |
true |
true/false |
autoHeight |
是否自动增高输入区域,type为textarea时有效(默认true) |
Boolean |
否 |
true |
true/false |
placeholder |
输入框的提示文字 |
String |
否 |
- |
- |
placeholderStyle |
placeholder的样式(内联样式,字符串),如"color: #ddd" |
String |
否 |
- |
- |
focus |
是否自动获得焦点(默认false) |
Boolean |
否 |
false |
true/false |
disabled |
是否禁用(默认false) |
Boolean |
否 |
false |
true/false |
maxlength |
最大输入长度,设置为 -1 的时候不限制最大长度(默认140) |
Number |
否 |
140 |
- |
confirmType |
设置键盘右下角按钮的文字,仅在type="text"时生效(默认done) |
String |
否 |
- |
- |
clearSize |
清除图标的大小,单位px(默认15) |
String |
否 |
15 |
- |
trim |
是否自动去除两端的空格 |
Boolean |
否 |
- |
true/false |
cursorSpacing |
指定光标与键盘的距离,单位 px |
String |
否 |
- |
- |
ajust-position |
当键盘弹起时,是否上推内容,默认值:true |
Boolean/String |
否 |
true |
true/false/both/left/right/start/end/all/none |
inputBorder |
是否显示input输入框的边框(默认true) |
Boolean |
否 |
true |
true/false |
component: DataCheckbox(DataCheckbox控件说明)
属性名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
mode |
显示模式mode = [default |
list |
button |
tag] |
String |
是 |
default |
default/list/button/tag |
multiple |
是否多选 |
Boolean |
否 |
false |
true/false |
options |
options 本地数据 ,格式 [{text:'',value:''}] |
Array |
是 |
[] |
- |
min |
最小选择个数 ,multiple为true时生效 |
Number/String |
否 |
- |
- |
max |
最大选择个数 ,multiple为true时生效 |
Number/String |
否 |
- |
- |
wrap |
是否换行显示 |
Boolean |
否 |
false |
true/false |
disabled |
是否禁用(默认false) |
Boolean |
否 |
false |
true/false |
map |
{Object} map 字段映射, 默认 map={text:'text',value:'value'} |
Object |
否 |
{text:'text',value:'value'} |
- |
component: Switch(Switch控件说明)
属性名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
activeColor |
激活时的颜色配置 |
String |
否 |
#108ee9 |
- |
inactiveColor |
未激活时的颜色配置 |
String |
否 |
#fff |
- |
size |
控件大小(单位px) |
Number |
否 |
24 |
- |
disabled |
是否禁用(默认false) |
Boolean |
否 |
false |
true/false |
activeValue |
激活时绑定的值 |
String/Number/Boolean |
否 |
true |
- |
inactiveValue |
未激活时绑定的值 |
String |
否 |
false |
- |
component: DataSelect(DataSelect控件说明)
属性名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
collapseTagsNum |
多选时选中值按文字的形式展示的数量 |
Nubmer |
否 |
- |
- |
collapseTags |
多选时是否将选中值按文字的形式展示 |
String |
否 |
- |
- |
options |
选项options |
Array |
是 |
[] |
- |
labelKey |
选项options绑定的显示key |
String |
是 |
text |
- |
valueKey |
选项options绑定的关键key |
String |
是 |
value |
- |
multiple |
是否多选 |
Boolean |
否 |
false |
true/false |
filterable |
是否开启搜索 |
Boolean |
否 |
false |
true/false |
clear |
是否可以清空已选项 |
Boolean |
否 |
true |
true/false |
emptyText |
没有数据时显示的文字 ,本地数据无效 |
String |
否 |
- |
- |
placeholder |
输入框的提示文字 |
String |
否 |
请选择 |
- |
disabled |
是否禁用 |
Boolean |
否 |
false |
true/false |
component: Slider(Slider控件说明)
属性名 |
说明 |
类型 |
是否必填 |
默认值 |
可选值 |
min |
最小可选值 |
Number, String |
否 |
0 |
- |
max |
最大可选值 |
Number, String |
否 |
100 |
- |
step |
步长,取值必须大于 0,并且可被(max - min)整除 |
Number, String |
否 |
1 |
- |
backgroundColor |
滑块左侧未选择部分的背景色 |
String |
否 |
#c0c4cc |
- |
blockSize |
滑块的大小,取值范围为 12 - 28 |
Number, String |
否 |
18 |
- |
blockColor |
滑块的颜色 |
String |
否 |
#ffffff |
- |
disabled |
禁用状态 |
Boolean |
否 |
false |
true/false |
showValue |
是否显示当前的选择值 |
Boolean |
否 |
false |
true/false |