“this”到局部变量的意外别名
.eslintrc.js
"@typescript-eslint/no-this-alias": [
"error",
{
"allowDestructuring": false, // Disallow `const { props, state } = this`; true by default
"allowedNames": ["that"] // Allow `const self = this`; `[]` by default
}
],
上面代码和 rules规则同级
这样页面上声明 let that = this; 就不会报错了
const that = this;