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

vue-post

v0.2.1

Published

send HTML Post requests from javascript

Downloads

10

Readme

vue-post

A Vuejs plugin to send HTML form action POST requests from Javascript or from any HTML element!

INFO: Maintainability GitHub license NPM Codacy Badge codebeat badge

Table of Contents

Features

  • Send HTML form action POST request from vue instance method.
  • Send HTML form action POST request from any HTML element.

Compatibility

Installation

From npm

npm install vue-post --save

Usage

Steps

import it

import vuePost from "vue-post"

Use as a plugin

Vue.use(vuePost)

After this we have access to global instance method post as this.post inside .vue files and global vue component Post inside .vue files.

From Instance Method

The instance method post takes 3 parameters.

  • action: the action URL of your form
  • target: window of action (expected: _self, _blank)
  • params: a json object of input values (See Notes)
/*any_component.vue*/

<template>
<!-- your HTML markup -->
<button @click="run">Post Form</button>
</template>
<script>
export default{
    //other code
    methods:{
        run(){
            this.post({
			action: the action URL of your form ,
			target: window of action (expected: _self, _blank),
			params: a json object of input values
            })
        }
    }

}
</script>

From HTML Element

We have access to global component Post which is a HTML a tag. It requires a single prop data which is a json object.

/*any_component.vue*/

<template>
<!-- your HTML markup -->
<Post :data="data"/>
</template>
<script>
export default{
    //other code
   data(){
   return{
   data:{
   	action: the action URL of your form ,
	target: window of action (expected: _self, _blank),
	params: a json object of input values
   }
}
}
</script>

Notes

The params parameter is an json object which contains the values of the input fields which are to be built and submitted inside a HTML form.

For the below implementation

this.post({
    action: "https://itatakimas.com",
    target:"_self",
    params:{
        NAME: "Zoro",
        EMAIL: "[email protected]",
    }
})

vue-post will build and submit the form as

<form action='https://itatakimas.com' target='_self' >
<input type='hidden' name='NAME' value='Zoro'/>
<input type='hidden' name='EMAIL' value='[email protected]'/>
</form>

For any help reach me 🕊twitter / 📧mail

Thank you!