R
R
Ruslan Absalyamov2019-03-06 16:05:40
Vue.js
Ruslan Absalyamov, 2019-03-06 16:05:40

Why doesn't the mask work in my component?

I took the component https://github.com/ankurk91/vue-flatpickr-component as a basis, but it is not possible to add a mask there, I do it with this lib https://www.npmjs.com/package/v-mask, and I decided to take the date component and try to add a mask. The component appeared and the data-mask tag appeared, but it is not processed, you can enter anything there.
In the sandbox example, it does not display correctly there, but you can see the whole code how I implemented it https://codesandbox.io/embed/k2jn4jox7o?fontsize=14

render(el) {
    return el("input", {
      attrs: {
        type: "text",
        "data-input": true
      },
      directives: [
        {
          name: "mask",
          value: "##.##.####"
        }
      ],
      props: {
        disabled: this.disabled
      },
      on: {
        input: this.onInput
      }
    });
  },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-03-06
@rusline18

Yes, because
Accordingly, add to your input

domProps: {
  value: this.value,
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question