recommended to output more detailed warning messages for the deprecated usage of deep selectors.
What problem does this feature solve?
So, here's the situation: while reviewing some code, I came across a console output stating that the ::v-deep usage as a combinator has been deprecated, and we should use :deep(<inner-selector>) instead.
then I tried to fix this warning by doing a global search of ::v-deep
in vscode, but found out that no one in the project actually used this deprecated method.
I feeling perplexed, I decided to set a breakpoint at the logging location in the compiler/sfc
file. There, I found out that when n.nodes.length
is 0
(I guess n.nodes is the sum of all selectors inside the parentheses) it will output this warning.
I suddenly realized that some people might use it like this :deep { property: value }
, and this doesn't seem to be an illegal usage.
In the end, I fixed this error usage and the warning disappeared.
I actually wanted to ask if it's possible to improve the output of this warning ?
The picture below is while I was debugging
What does the proposed API look like?
:deep(selector) { }