clear-on-disable

1.0.0 • Public • Published

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.
});

Package Sidebar

Install

npm i clear-on-disable

Weekly Downloads

8

Version

1.0.0

License

MIT

Unpacked Size

456 kB

Total Files

17

Last publish

Collaborators

  • jeffreydotdev