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

form-create-wot

v0.1.2

Published

form-create JSON 动态表单渲染引擎,基于 wot-design-uni 组件库,适用于 uni-app 移动端(H5/小程序/App)

Downloads

165

Readme

form-create-wot

form-create JSON 动态表单渲染引擎,基于 wot-design-uni,适用于 uni-app 移动端

将管理端 form-create(Ant Design Vue / Element Plus)设计的 JSON 表单配置,在 uni-app 移动端(H5 / 小程序 / App)使用 wot-design-uni 组件渲染。

安装

npm install form-create-wot

前置依赖:项目中需已安装 wot-design-unisass

配置

1. 注册插件

// main.ts
import { createSSRApp } from 'vue'
import App from './App.vue'
import FormCreateWot from 'form-create-wot'

export function createApp() {
  const app = createSSRApp(App)
  app.use(FormCreateWot)
  return { app }
}

2. 配置 easycom(pages.json)

{
  "easycom": {
    "autoscan": true,
    "custom": {
      "^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue",
      "^fc-form$": "form-create-wot/src/fc/components/FcForm.vue",
      "^fc-form-item$": "form-create-wot/src/fc/components/FcFormItem.vue",
      "^fc-select$": "form-create-wot/src/fc/adapter/fc-select.vue",
      "^fc-radio$": "form-create-wot/src/fc/adapter/fc-radio.vue",
      "^fc-checkbox$": "form-create-wot/src/fc/adapter/fc-checkbox.vue",
      "^fc-date-picker$": "form-create-wot/src/fc/adapter/fc-date-picker.vue"
    }
  }
}

使用

基础用法

<template>
  <fc-form
    :rule="rules"
    :option="option"
    v-model:api="fApi"
    @submit="onSubmit"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import type { FormApi, FormRule, FormOption } from 'form-create-wot'

const fApi = ref<FormApi | null>(null)

const rules = ref<FormRule[]>([
  {
    type: 'input',
    field: 'name',
    title: '姓名',
    props: { placeholder: '请输入姓名' },
    validate: [{ required: true, message: '请输入姓名' }]
  },
  {
    type: 'select',
    field: 'gender',
    title: '性别',
    options: [
      { label: '男', value: 'male' },
      { label: '女', value: 'female' }
    ]
  },
  {
    type: 'switch',
    field: 'vip',
    title: 'VIP',
    value: false
  }
])

const option = ref<FormOption>({
  submitBtn: { text: '提交', show: true },
  resetBtn: { text: '重置', show: true }
})

const onSubmit = (data: Record<string, any>) => {
  console.log('表单数据:', data)
}
</script>

从后端 API 加载 JSON

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { parseJsonString } from 'form-create-wot'

const rules = ref([])

onMounted(async () => {
  // 从芋道后端获取 form-create 的 JSON 配置
  const [err, res] = await uni.request({ url: '/api/bpm/form/get?id=1' })
  if (res?.data?.data?.conf) {
    rules.value = parseJsonString(res.data.data.conf)
  }
})
</script>

fApi 操作

// 获取表单数据
const data = fApi.value.formData()

// 设置字段值
fApi.value.setValue('name', '张三')

// 批量设置
fApi.value.setValues({ name: '张三', gender: 'male' })

// 校验
await fApi.value.validate()

// 禁用/启用
fApi.value.disabled(true)
fApi.value.disabled(false, 'name')

// 显隐
fApi.value.hidden(true, 'gender')

// 重置
fApi.value.resetFields()

支持的组件类型

| type | 说明 | wot 组件 | |---|---|---| | input | 文本输入 | wd-input | | textarea | 文本域 | wd-textarea | | InputNumber | 数字输入 | wd-input-number | | select | 下拉选择 | wd-select-picker | | radio | 单选 | wd-radio-group | | checkbox | 多选 | wd-checkbox-group | | switch | 开关 | wd-switch | | datePicker | 日期选择 | wd-datetime-picker | | timePicker | 时间选择 | wd-datetime-picker | | rate | 评分 | wd-rate | | slider | 滑块 | wd-slider |

同时兼容 antdv 别名(如 a-inputa-select 等)

平台兼容性

| 平台 | 状态 | |---|---| | H5 | ✅ | | 微信小程序 | ✅ | | 支付宝小程序 | ✅ | | Android App | ✅ | | iOS App | ✅ |

License

MIT