punithan antony
punithan antony

Reputation: 65

How to use ::v-deep(<inner-selector>) in vue?

I am trying to apply existing style class to child element which will loaded using v-html, Since /deep/ and >>> is deprecated i tried with ::v-deep in vue.

<template>
<div v-else v-html="childHtml" class="parent-class"></div>
</template>

<style scoped>
.parent-class ::v-deep .child-class {
  border: unset;
  border-radius: 2px;
  margin: 0 auto;
  margin-bottom: 2%;
  background-color: #fff;
  box-sizing: border-box;
  zoom: 70%;
}
</style>

But vue compiler says, *::v-deep usage as a combinator has been deprecated. Use ::v-deep() instead. (using Vue 3.0.0-beta.1)

How to use ::v-deep() and get rid of this compilation error ??

please help, Thanks in advance

Upvotes: 1

Views: 7446

Answers (1)

Mark
Mark

Reputation: 175

You can try and use the >>> .class-i-want-deep{ /// } if you're not using sass/scss. Docs from vue-loader here In terms of the error message, it says:

"*::v-deep usage as a combinator has been deprecated. Use ::v-deep() instead. (using Vue 3.0.0-beta.1)"

So it looks like your syntax for ::v-deepis here is no longer allowed in Vue 3. Try using the new ::v-deep(), I can't find the docs for that specifically. Update: Looks like ::v-deep() usage with 3.0 is working for OP. Have not reproduced it yet.

Upvotes: 2

Related Questions