@asigloo/vue-dynamic-forms

中文文档
3.18.1发布于 2022/02/07TypeScriptESM + CJS近 30 天下载 3069

Easy way to dynamically create reactive forms in vue based on varying business object model

原始使用文档
文档目录17 节
  1. Status: Stable
  2. Documentation
  3. You can help me keep working on this project 💚
  4. Installation
  5. Usage
  6. Demos
  7. Development
  8. Project setup
  9. Compiles and hot-reloads
  10. Compiles and minifies for production
  11. Generate types
  12. Lints and fixes files
  13. Run your unit tests
  14. Run your e2e tests
  15. Contributing
  16. Todolist
  17. License

Library Banner

Vue 3.x.x Dynamic Forms

Current npm version Minified size Vue.js version

Implementing handcrafted forms can be:

  1. Costly
  2. Time-consuming

Especially if you need to create a very large form, in which the inputs are similar to each other, and they change frequently to meet rapidly changing business and regulatory requirements.

So, wouldn't it be more economical to create the forms dynamically? Based on metadata that describes the business object model?

That's Vue Dynamic Forms.

Status: Stable

This is the Vue 3.x.x compatible version. Out of the box Typescript support, tree shakeable, improved accessibility and lighter in size. For Vue 2.x.x please use the library tags 2.x.

Documentation

Complete documentation and examples available at

You can help me keep working on this project 💚

Generous Unicorns 🦄

OmgImAlexis

Accesible Benevolents 🦄

easingthemes

Installation

$ npm install @asigloo/vue-dynamic-forms

or if you prefer yarn

$ yarn add @asigloo/vue-dynamic-forms

Usage

The installation and usage has change to align with new Vue 3 plugin installation.

To create a new Dynamic Form instance, use the createDynamicForms function;

import { createApp } from 'vue'
import { createDynamicForms } from '@asigloo/vue-dynamic-forms'

const VueDynamicForms = createDynamicForms()

export const app = createApp(App)

app.use(VueDynamicForms)

In your component:

<template>
  <dynamic-form :form="form" @change="valueChanged" />
</template>

<script lang="ts">
import { computed, defineComponent, reactive } from 'vue';

import {
  CheckboxField,
  TextField,
  SelectField,
} from '@asigloo/vue-dynamic-forms';

export default defineComponent({
  name: 'BasicDemo',
  setup() {
    const form = ref({
      id: 'basic-demo',
      fields: {
        username: TextField({
          label: 'Username',
        }),
        games: SelectField({
          label: 'Games',
          options: [
            {
              value: 'the-last-of-us',
              label: 'The Last of Us II',
            },
            {
              value: 'death-stranding',
              label: 'Death Stranding',
            },
            {
              value: 'nier-automata',
              label: 'Nier Automata',
            },
          ],
        }),
        checkIfAwesome: CheckboxField({
          label: 'Remember Me',
        }),
      },
    });

    function valueChanged(values) {
      console.log('Values', values);
    }

    return {
      form,
      valueChanged,
    };
  },
});
</script>

Demos

Vue Dynamic Forms Demo

We've prepared some demos to show different use cases of the library and how to use each type of input field.

To check them just run the command bellow which run the app at http://localhost:3000/

yarn run serve
  • General Form
  • Text Fields
  • Number Fields
  • Select Fields
  • Textarea Fields
  • Radio Fields
  • Login
  • Custom Fields
  • Axios form (Retrieve form structure from an API)
  • TailwindCSS styling

Development

Project setup

yarn install

Compiles and hot-reloads

yarn run serve

Compiles and minifies for production

yarn run build

Generate types

yarn run build:dts

Lints and fixes files

yarn run lint

Run your unit tests

yarn run test

Run your e2e tests

yarn run test

Contributing

If you find this library useful and you want to help improve it, maintain it or just want a new feature, feel free to contact me, or feel free to do a PR 😁.

Todolist

  • Update docs

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

版本与发布记录

@asigloo/vue-dynamic-forms 共发布 87 个版本,首次发布于 2020/03/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.18.1latest2022/02/074 年前
3.18.02021/09/245 年前
3.17.22021/09/215 年前
3.17.12021/09/205 年前
3.17.02021/09/205 年前
3.16.32021/08/245 年前

其他发布通道:next → 3.12.0。

关于 @asigloo/vue-dynamic-forms 的常见问题

@asigloo/vue-dynamic-forms 是什么?

Easy way to dynamically create reactive forms in vue based on varying business object model

如何安装 @asigloo/vue-dynamic-forms?

在项目目录运行 npm install @asigloo/vue-dynamic-forms,或使用 pnpm add / yarn add / bun add。

@asigloo/vue-dynamic-forms 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@asigloo/vue-dynamic-forms 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@asigloo/vue-dynamic-forms 可以商用吗?

@asigloo/vue-dynamic-forms 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@asigloo/vue-dynamic-forms 的下载量有多少?

根据 npm 官方下载统计,@asigloo/vue-dynamic-forms 在 2026/10/07 – 2026/11/05 这 30 天内被下载 3,069 次,日均约 102 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@asigloo/vue-dynamic-forms 还在维护吗?

最新版本 3.18.1 发布于 2022/02/07(4 年前);至今共发布 87 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/03/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。