Why I get 'avoid using JavaScript unary operator as property name' in vue.js?
I'm wondering what is wrong here
delete
is an operator defined in JavaScript.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
and how to fix it?
Choose a different method name than delete
...
You can name whatever you want as your property name in an object. But binding in a v-on:
requires to be an expression. Using delete
keyword there supposed be uncompleted expression. If you choose other than the reserved keyword, then you get the method that you have defined in your vue instance.
I can see the following error on visual code IDE:
[vue-language-server] 'v-on' directives require that attribute value or verb modifiers.
[vue-language-server] Parsing error: Unexpected end of expression.
Thus to resolve the problem you must give a different name which is not reserved keyword in JavaScript.