‘scope‘ is defined but never used

When the scope attribute is used in the template, wavy lines or compilation errors may appear, but the final compilation result is normal.
In fact, this is caused by the ESlint plug-in checking the grammar specification, and this problem will not affect the normal operation of the program.
insert image description here
It shows that the scope variable is defined, but never used.
Compiler error description:
insert image description here
In fact, the second and third lines give the solution, and block the errors in the compilation process according to the command prompt.
(1) Use of the eslint-disable command

The eslint-disable command means that all files following the line where the command is located will be checked and masked for grammar specification, and the masking will end if the eslint-enable command is encountered.

  • If you want to shield the grammar specification check of the entire document, use the eslint-disable command directly at the beginning of the file, use it in the template tag of the Vue file like this: , and use it like this in the script tag
    <!-- eslint-disable -->:/* eslint-disable */

  • If you want to block the grammar specification check of a certain piece of code, then combine the eslint-disable and eslint-enable commands and use it in the template tag of the Vue file like this: and two commands to wrap a certain code block, in
    <!--eslint-disable --> the script tag like this <!--eslint-enable>Use : /* eslint-disable */and /*eslint-enable */two commands to wrap a block of code.

(2) Use of the eslint-disable-next-line command

The eslint-disable-next-line command indicates that the code specification of the next line of the line where the command is located is shielded and checked.

  • Use this in the template tag of the Vue file:<!-- eslint-disable-next-line -->

  • Use this in the script tag of the Vue file:// eslint-disable-next-line

Guess you like

Origin blog.csdn.net/weixin_44244924/article/details/130082336