Socket
Socket
Sign inDemoInstall

vue-jquery-mask

Package Overview
Dependencies
23
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-jquery-mask

Vue.js component for jquery mask plugin


Version published
Weekly downloads
145
increased by5.07%
Maintainers
1
Install size
1.61 MB
Created
Weekly downloads
 

Changelog

Source

2.0.0

  • Add support for Vue v3.x
  • For Vue v2.x use v1.x

Readme

Source

Vue jQuery Mask Component

downloads npm-version github-tag license

Vue.js component for jQuery Mask Plugin

Demo on JSFiddle

Version matrix

Vue.js versionPackage versionBranch
2.x1.x1.x
3.x2.xmaster

Requirements

  • jQuery >=1.7.0
  • Vue 3.x

Installation

# Yarn
yarn add vue-jquery-mask

# npm
npm install vue-jquery-mask
Using Webpack?
// webpack.config.js
plugins: [
    new webpack.ProvidePlugin({     
      jQuery: 'jquery',
      'window.jQuery': 'jquery',
      $: 'jquery',     
    }),
  ]  

Usage Example

<template>
  <div>
    <vue-mask 
        class="form-control" 
        v-model="date"  
        mask="00/00/0000" 
        :raw="false"
        :options="options"> 
    </vue-mask>
  </div>
</template>

<script>
  // Import this component
  import vueMask from 'vue-jquery-mask';
  
  export default {    
    data () {
      return {
        date: null,
        options: {
          placeholder: '__/__/____',
          // http://igorescobar.github.io/jQuery-Mask-Plugin/docs.html
        }       
      }
    },
    components: {
      vueMask
    }
  }
</script>
As plugin
  import {createApp} from 'vue';
  import VueMask from 'vue-jquery-mask';
  const app = createApp().mount('#app')   
  app.use(VueMask);

This will register a global component <vue-mask>

Available props

The component accepts these props:

AttributeTypeDefaultRequired?Description
v-modelString / nullnulltrueSet or Get input value
maskString / Function trueMasking pattern
optionsObject{}falseConfiguration options
rawBooleantruefalseWhen set to false; emits formatted value with format pattern and delimiters

Install in non-module environments (without webpack)

<!-- Vue js -->
<script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
<!-- Lastly add this package -->
<script src="https://cdn.jsdelivr.net/npm/vue-jquery-mask@2"></script>
<!-- Register global component -->
<script>
// Your app init login may go here
app.use(VuejQueryMask)
</script>

Run examples on your localhost

  • Clone this repo
  • You should have node-js >=10.13 and yarn >=1.x pre-installed
  • Install dependencies - yarn install
  • Run webpack dev server - yarn start
  • This should open the demo page at http://localhost:9000 in your default web browser

Changelog

Please see CHANGELOG for more information what has changed recently.

License

MIT License

Keywords

FAQs

Last updated on 27 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc