1.0.0 • Published 4 years ago
clear-on-disable v1.0.0
clear-on-disable
A small package for Vue that clears HTML form fields when they're being disabled.
Install
Download the package
yarn
yarn add clear-on-disable
npm
npm i clear-on-disable
Use the package in your main file
import ClearOnDisable from 'clear-on-disable';
Vue.use(ClearOnDisable);
Usage
Text
<input type="text" v-model="variable" :disabled="disableVariable" v-clear-on-disable />
Textarea
<textarea v-model="variable" :disabled="disableVariable" v-clear-on-disable></textarea>
Select
<select v-model="variable" :disabled="disableVariable" v-clear-on-disable>
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
</select>
Checkbox
<input type="checkbox" v-model="variable" :disabled="disableVariable" v-clear-on-disable />
Options
The following options are available and have these default values:
Vue.use(ClearOnDisable, {
disableRadioButtonWarning: false // When using v-clear-on-disable on radio buttons you will get a console warning because there's weird behaviour.
});