Vue + elementUI, listens for a field in the form form in watch and pops up a warning.

listen for a field in the form form in watch and pop up a warning. Did not report wrong before, I do not know what reason suddenly there is such a warning, write a vue project, do not understand the reason, have encountered or know the god to help guide, thank you!

Code:

watch: {
        //  1518
        "form.sfzhm": function (val) {
            if (val.length === 15) {
                this.form.sfzhm = cardExchangeIsValid(val);
            } else if (val.length === 18) {
                const flag = val.charAt(val.length - 2) % 2 === 0;
                const birth = `${val.substring(6, 10)}-${val.substring(10, 12)}-${val.substring(12, 14)}`;
                this.form.xb = flag ? "2" : "1";
                this.form.csrq = birth;
                // this.getHjszd();
            }
        }

warning screenshot:

Mar.10,2021

what does your data look like


the reason is that eslint uses rules. Adding a line of comments can solve

.
//  1518
/* eslint-disable func-names */

A way to handle it correctly?

watch: {
    'form.sfzhm': {
        handler (val) {
            console.log(val)
        }
    }
}
Menu