A pure Vue component submit button with a Ladda-style spinner.

Based on NxtChg/pieces vue-submit but with a different approach, using vue-cli 3 and published as a component, plugin and vue cli 3 plugin.

Step 1: Installation

Using npm:

$ npm install vue-submit

Step 2: Usage

Using Vue (with Webpack) in your src/main.js or other webpack entry file:

// Load the Vue plugin globally to compile via Babel in Webpack (using vue-cli-3).
import Vue from 'vue'
import { Plugin } from 'vue-submit'

// To use the default options: { defaultButtonType = 'submit', tagName = 'vue-submit' }

// Or choose a different tag name for the component
Vue.use(Plugin, { tagName: 'an-alternative-vue-submit-tag-name' })

// Or choose the default button type for the button created. By default this is 'submit',
//  but you may want 'button' to use the spin functionality without submitting a form
Vue.use(Plugin, { defaultButtonType: 'button' })

And in your SFC (with the plugin activated):

    <vue-submit :disabled='disabled'>A disabled button</vue-submit>
    <vue-submit type='button' :disabled='disabled'>A disabled button that behaves like a normal button instead of a submit button</vue-submit>

    <form method='GET' @submit.prevent='onSubmitDummy'>
        <vue-submit :started='siblingStarted' @started='siblingStarted=true'> {{ siblingStopPrimaryText }}</vue-submit>
        <button type='button' :disabled='!siblingStarted' @click='onSiblingStop'> {{ siblingStopSecondaryText }}</button>

export default {
    data() {
        return {
            disabled: true,
            siblingStarted: false,
            siblingStopPrimaryText: 'Click to confide in me',
            siblingStopSecondaryText: 'Waiting for my sibling to start spinning'
    watch: {
        siblingStarted(started) {
        if (started) {
            this.siblingStopPrimaryText = "I'm spinning around, get out of my way!"
            this.siblingStopSecondaryText = 'Click me to stop my sibling'
        } else {
            this.siblingStopPrimaryText = 'Click to confide in me'
            this.siblingStopSecondaryText = 'Waiting for my sibling to start spinning'
    methods: {
        onSubmitDummy() {
            // a dummy function to prevent actual form submission
        onSiblingStop() {
            this.siblingStarted = false

Or to use in your SFC as above, but with the component and not the plugin:


import VueSubmit from 'vue-submit'

export default {
    components: {
        'vue-submit': VueSubmit

To use the ES6 module outside of vue-cli-3, but within webpack (with Babel), try the webpack-babel-env-deps Babel plugin to ensure the imports are imported as-is.

If (for some reason) you don’t want to use the raw ES Vue component, there is also:

// The common-js version
<script src=""></script>

// The UMD version
<script src=""></script>


Below are the reference links:

No. Link
1. Read more here.
2. Follow code author here.