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.
Installation
Using npm:
$ npm install vue-submit
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). // To use the default options: { defaultButtonType = 'submit', tagName = 'vue-submit' }Vue // Or choose a different tag name for the componentVue // 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 formVue
And in your SFC (with the plugin activated):
A disabled button A disabled button that behaves like a normal button instead of a submit button {{ siblingStopPrimaryText }} {{ siblingStopSecondaryText }}
Or to use in your SFC as above, but with the component and not the plugin:
...
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="https://unpkg.com/vue-submit/dist/vue-submit.common.js"></script> // The UMD version<script src="https://unpkg.com/vue-submit/dist/vue-submit.umd.min.js"></script>