npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

icarys-fc-vant

v1.0.27

Published

基于FormCreate和Vant的移动端低代码表单组件库,可以通过JSON生成具有动态渲染、数据收集、验证和提交功能的表单

Readme

@icarys/fc-vant

基于 FormCreate 和 Vant 的移动端低代码表单组件库

特性

  • 🚀 基于 Vue 3 + Vant 4
  • 📱 专为移动端优化
  • 🎯 通过 JSON 配置生成表单
  • 🔧 支持动态渲染、数据收集、验证和提交
  • 📦 开箱即用,简单易集成

安装

# 安装组件库
npm install @icarys/fc-vant

# 安装必需的依赖(Vue 3 和 Vant)
npm install vue@^3.1.0 vant@^4.0.0

使用

基础用法

方法1:在模板中使用组件

导入使用

import Vue from 'vue'
import Vant from 'vant'
import 'vant/lib/index.css'
import formCreate from '@icarys/fc-vant'

Vue.use(Vant)

// 创建表单规则
const rule = [
  {
    type: 'input',
    field: 'name',
    title: '姓名',
    props: {
      placeholder: '请输入姓名'
    }
  },
  {
    type: 'select',
    field: 'city',
    title: '城市',
    options: [
      { label: '北京', value: 'beijing' },
      { label: '上海', value: 'shanghai' }
    ]
  }
]

// 创建表单实例
const $f = formCreate.create(rule)

// 挂载到DOM
$f.mount('#form-container')

// 或者提交表单
$f.submit().then(data => {
  console.log('表单数据:', data)
})

使用工具方法

import formCreate from '@icarys/fc-vant'

// 解析JSON规则
const rules = formCreate.jsonParse('[{"type":"input","field":"name"}]')

// 序列化对象为JSON
const jsonString = formCreate.jsonStringify(rules)

// 创建表单
const $f = formCreate.create(rules)

在 Vue 组件中使用

<template>
  <div>
    <div id="form-container"></div>
  </div>
</template>

<script>
import { formCreateMobile } from '@icarys/fc-vant'

export default {
  mounted() {
    const rule = [
      {
        type: 'input',
        field: 'name',
        title: '姓名',
        props: {
          placeholder: '请输入姓名'
        }
      }
    ]

    const $f = formCreateMobile(rule)
    $f.mount('#form-container')
  }
}
</script>

API

formCreateMobile(rule, options)

创建表单实例

  • rule: 表单配置规则数组
  • options: 配置选项

返回表单实例对象,包含以下方法:

  • mount(selector): 挂载到DOM元素
  • destroy(): 销毁表单实例
  • resetFields(): 重置表单
  • validate(): 验证表单
  • getValue(): 获取表单值
  • setValue(data): 设置表单值

支持的组件类型

  • input - 输入框
  • textarea - 文本域
  • select - 下拉选择
  • radio - 单选框
  • checkbox - 多选框
  • switch - 开关
  • datePicker - 日期选择器
  • timePicker - 时间选择器
  • calendar - 日历
  • uploader - 文件上传
  • cascader - 级联选择

依赖要求

  • Vue ^3.1.0
  • Vant ^4.0.0

开发

# 安装依赖
npm install

# 开发模式
npm run dev

# 发布(直接发布源文件,无需构建)
npm publish

许可证

MIT