New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

formnic

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formnic

A form page builder

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
1
-93.75%
Maintainers
2
Weekly downloads
 
Created
Source

Formnic

页面快速生成系统

控制台

https://formnic.faas.elenet.me

文档

https://formnic.faas.elenet.me/docs/#/

安装

npm install formnic -S

使用

在控制台制作表单,之后在项目中使用

以 Class 的方式

Formnic 默认导出了一个 Class:

HTML

<div id="form"></div>

JavaScript

import Formnic from 'formnic'
import 'formnic/lib/index.css'

const form = new Formnic('#form', {
  formId: '59391db161e4722ff7f4d2c0',
  onSubmit(data) {
    // process data
  },
  showSubmit: false, // whether to show the submit button, default true
  // provide data to initial the form
  model: {
    name: 'jack',
    age: 30,
    sex: 'female'
    // ....
  }
})
form.getModel()  // get current form model
form.reset() // reset form
form.validate(isValid => { console.log(isValid); }); // validate form
form.submit() // submit form

以组件的方式

如果你的项目使用了 Vue,还可以使用 Formnic 组件:

<template>
  <Formnic
    :model="model"
    form-id="59391db161e4722ff7f4d2c0"
    :on-submit="submit"
    ref="form" />
</template>
<script>
  import { Formnic } from 'formnic'
  import 'formnic/lib/index.css'

  export default {
    components: {
      Formnic
    },

    data() {
      return {
        model: {}
      }
    },

    methods: {
      submit(data) {
        // process data
      },
      reset() {
        this.$refs.form.reset()
      },
      validate() {
        this.$refs.form.validate(valid => {
          console.log(valid)
        })
      }
    }
  }
</script>

FAQs

Package last updated on 03 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts