更新时间:2022-06-24 14:16:59
可以,有一个解决方案。您可以在ESlint配置文件中添加以下对象
{
"@typescript-eslint/no-this-alias": [
"error",
{
"allowDestructuring": true, // Allow `const { props, state } = this`; false by default
"allowedNames": ["vm"] // Allow `const vm= this`; `[]` by default
}
]
}
有关更多信息,请查看TSLint:no-this-assignment