reason:
eslint
the code checks that you registered the component but did not use it, and then reports an error. For example, code:
For example, the file
component is registered in Vue
, but it is not actually used:
...
import File from "../../components/file";
export default {
components: {Pagination, File},
...
At this time, you can cancel the registration. Of course, sometimes we don’t want to cancel and don’t change the code. There are two solutions:
Method 1:
Modify the package. JSON
in package.JSON
, find rules
under eslintconfig
, and add "Vue/no unused components": "off"
Method 2:
If there is a eslintrc.JS
file in the project, you can add it as well:
rules: {
"vue/no-unused-components": "off"
}
Either of the two can be used. Restart the project after modification. Note: if both files are modified, the eslintrc.JS
file has higher priority.