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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@e9ine/vue-form-plugin

v1.0.1

Published

Docs : [https://vue9-form-plugin.netlify.app](https://vue9-form-plugin.netlify.app)

Downloads

61

Readme

vue-form-plugin

Docs : https://vue9-form-plugin.netlify.app

Build Status Netlify Status

Installation

Full Plugin Usage

Even though vue-form-plugin is so simple, you don't really need to set import locally within each component - you can simply set it up by using the plugin on Vue instance for a better developer experience.

To set up a new instance of vue-form-plugin, and start developing just use it like below:

import Vue from 'vue';
import VueFormPlugin from '@e9ine/vue-form-plugin';

Vue.use(VueFormPlugin);

You can also pass options if you do not plan to use FormFor in your project.

import Vue from 'vue';
import VueFormPlugin from '@e9ine/vue-form-plugin';

Vue.use(VueFormPlugin, {
    formFor: false
});

Note: CSS will be auto imported in this case. No need to manually import

Tree Shaking Usage

You can also import it separately in each component and use.

import {FormFor, FieldFor} from '@e9ine/vue-form-plugin';

export default {
    components: {
        FieldFor,
        FormFor
    }
}

Note: CSS will be auto imported in this case. No need to manually import

SFC & Dynamic import Usage

To use the dynamic import version for FieldFor, load the plugin from src directory. This will follow on-demand loading for each component via dynamic imports.

You will also need to manually include the scss in this case.

import Vue from 'vue';
import VueFormPlugin from '@e9ine/vue-form-plugin/src';

Vue.use(VueFormPlugin); // options if any same as Full Plugin Usage

You can also import each component via tree shaking in your local components. This should be the preferred way if you are planning to use forms in only limited pages, suitable for websites.

import {FormFor, FieldFor} from '@e9ine/vue-form-plugin/src';

Manually include CSS/SCSS in your style.scss. You can either import style.scss or manually pick certain scss files to be imported.

@import '~@e9ine/vue-form-plugin/src/scss/style.scss';

CDN Usage (Browser)

Include vue-form-plugin in the page. Make sure to keep the component name in kebab case as running Vue in browser mode can't detect capitalised component names.

No need to write Vue.use line since plugin will take care of automatically getting installed in Global Vue context.

Look at a simple example below :

<head>
    <title>Browser build</title>
    <script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
    <script src="https://unpkg.com/@e9ine/vue-form-plugin"></script>
</head>
<div id="app">
    <field-for 
            type="Number" 
            label="Counter" 
            :value.sync="counter" 
            display-mode="EDIT">
    </field-for>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            counter: 0
        }
    });
</script>

CDN Usage (ESM)

<script type="module">
    import Vue from "https://unpkg.com/browse/[email protected]/dist/vue.esm.browser.js"
    import VueFormPlugin from  "https://unpkg.com/@e9ine/vue-form-plugin/dist/vue-form-plugin.esm.js";
</script>

Examples

There are two ways to build forms with this plugin.

  1. Custom Usage with only FieldFor:
  • type, value, label and displayMode props are required for this form scheme.
  • This is a minimal setup required to display fields within forms. For error mechanism, you will have to handle it externally through computed properties.
<FieldFor type="Text" :value.sync="name" label="Name" display-mode="EDIT"></FieldFor>
  1. Using FormFor
  • This way is a more recommended way to use forms since it additionally gives you features to check if form is valid or not, error mechanism etc.
  • component acts as a parent to all its children and tracks the incoming and outgoing data by processing the events.
  • Technically you have to pass the schema of the form and rest is taken care by the plugin. An Example is available below.
<FormFor :data="address" display-mode="EDIT">
    <FieldFor field="Line1"></FieldFor>
    <FieldFor field="Line2"></FieldFor>
</FormFor>

Check out more in docs.