Skip to content

[2.2.3] Clear if value is zero feature is broken #42

Closed
@ankurk91

Description

@ankurk91

Hi,

Expected Behavior

If v-model value is 0.00 then input field should clear on focus

Actual Behavior

Input remains same

Steps to Reproduce the Problem

http://jsfiddle.net/cvg6c4r3/6/

I have also tried adding a directive but no luck

Vue.directive('clear-zero', {
  bind: function (el, binding, vnode) {
    el.onfocus = function () {
      if (parseFloat(el.value) === 0) {
        console.log('Clear value');
        el.value = null;
      }
    };
  }
});
<vue-numeric v-clear-zero currency="$" :precision="2" v-model.number="money"></vue-numeric>

Specifications

  • Plugin Version: 2.2.3+
  • Vue.js Version: 2.5.2/2.4.4
  • Browser: chrome 62 beta
  • OS: macOs sierra

Ref #26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions