1.0.2 • Published 4 years ago
vue-regex-input v1.0.2
vue-regex-input
A vue input component that only allows input based on a passing regex
Install
npm install vue-regex-inputQuick start
<vue-regex-input class="some-class"
:regExp="/^\d*(\.\d{0,2})?$/g" //match alphanumerics
@input="handleInput"
@change="handleChange"
v-model="val">
</vue-regex-input>Add to build
As this project uses the newer vue-loader v13+ you need to import the module in a slightly different way. https://github.com/vuejs/vue-loader/releases/tag/v13.0.0
// before
const Foo = require('./Foo.vue')
// after
const Foo = require('./Foo.vue').default
// alternatively just use the ES6 module style
import vSelect from 'vue-regex-input';
Vue.component( 'vue-regex-input', vSelect );Development
npm scripts
To build the library:
npm run buildTo build the basic demo:
npm run demoTo start the dev page with hot reloading
npm run devTo run all tests
npm testTo generate doc file based on jsdoc
npm run jsdocCoverage
coverage threashold is defined in the root package.json. Default test task will check the coverage.