Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Prevent field clean when changing mask #576

@cesartagplus

Description

@cesartagplus

Hi!

I have a dynamic mask, and when the mask changes (based on another inputs) it cleans the field. I want to prevent this, and clean the field only if the test fails. Is there a way ?

the code looks like this:

          <el-input
            v-model="test"
            v-mask="customMask"
          />
watch: {
 inputC: {
      immediate: true,
      handler () {
        this.customMask = this.changeMask(inputA, inputB)
      }
    }
}
methods: {
changeMask = (inputA, inputB) => {
 
  let actualMask = []

  if (inputA) {
    actualMask = [/1/, '.', /\d/, /\d/, /\d/]
  }

  if (inputB) {
    actualMask = [/2/, '.', /\d/, /\d/, /\d/]
  }
  
  return actualMask
}
}

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