Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue 3 ::v-deep usage as a combinator has been deprecated. Use ::v-deep(<inner-selector>) instead

Tags:

css

vue.js

vuejs3

I started getting the following warning in Vue 3 with the ::v-deep usage.

::v-deep usage as a combinator has been deprecated. Use ::v-deep(<inner-selector>) instead

The CSS looks like as follows:

.parent ::v-deep .child {
   ...
}

What's the correct way to use suggested option ::v-deep(<inner-selector>)?

like image 436
Manoj Shrestha Avatar asked Sep 21 '20 04:09

Manoj Shrestha


3 Answers

The relevant RFC is here:

https://github.com/vuejs/rfcs/blob/master/active-rfcs/0023-scoped-styles-changes.md

I believe you need to change it to:

.parent ::v-deep(.child) {

Update:

The warning message mentioned in the question has been changed in later versions of Vue 3 to recommend using :deep() instead. This is an alias for ::v-deep() and it has been added to the documentation here:

https://v3.vuejs.org/api/sfc-style.html#deep-selectors

like image 149
skirtle Avatar answered Oct 16 '22 09:10

skirtle


Little update: now, you need to change it to:

.parent :deep(.child) {
like image 34
eightball Avatar answered Oct 16 '22 09:10

eightball


This issue also occurs in Vue 2.7

[@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.

I I think neither of the solutions above solve that warning.

Edited working using:

:deep() {
  .class {}
}

But it finds error in npm dependencies as well

like image 9
Simon Klimek Avatar answered Oct 16 '22 10:10

Simon Klimek