question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changes are not reflected back to model when using with Vue2

See original GitHub issue

Changes are not reflected back to model

Declaring directive

Vue.directive('input-mask', {
  bind: function(el, o, v) {
     $(el).inputmask();
  }
});

Declaring control

<input type="text" class="form-control" name="code"
placeholder="Enter code" v-model="code"
v-input-mask data-inputmask="'mask': '9999999999[9][9]', 'greedy' : false">

Description of problem

Mask is applied correctly. However when I modify value in form changes are not saved in model. Not on keypress not on blur.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:28 (14 by maintainers)

github_iconTop GitHub Comments

8reactions
dermanov-rucommented, Nov 2, 2018

Have no time to modify project core libs.

The fast solution - assign new value manually at every keyup event 😃

JS

$('input.phone').inputmask('mask', {'mask': '+7 (999) 999-99-99'});

HTML + VUE

<input class="phone" v-model="PHONE" @keyup="PHONE = this.event.target.value;">
6reactions
RobinHerbotscommented, Apr 10, 2017

@adyz , npm i inputmask

in your code => var Inputmask = require(“inputmask”)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js: Data is not updating with state change so the re-render ...
I'm using mapState import { mapState } from 'vuex to watch for a state change. computed: { ...mapState(['getFreeVideo']) }. I am not seeing...
Read more >
Why Your Vue Component Isn't Updating (and how to fix it)
1. Check that variables are reactive · 2. Make sure to update Arrays and Objects correctly (only in Vue 2) · 3. Use...
Read more >
Component not updating when data changes - Vue Forum
Unfortunately when this data changes the component does not reflect that change. I've tried using both watch and update and different ...
Read more >
Vue 3.1 - Official Migration Build from Vue 2 to 3 - This Dot Labs
This incldues breaking changes such as v-model , which had a syntactic change in Vue 3. The intent of the migration build is...
Read more >
Understanding the New Reactivity System in Vue 3 - SitePoint
Every time the model changes, the view is re-rendered to reflect the changes. Let's take a simple Markdown editor as an example.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found