A
A
alaskafx2021-09-26 11:45:36
Vue.js
alaskafx, 2021-09-26 11:45:36

How can I give the pseudo-element an image name and apply it?

There is this code:

<div class="card" v-for="(card, index) in offers" :key="index">
            <div class="cwrap">
              <img :src="require(`@/assets/${card.title}.svg`)" alt="" />
              <b>{{ card.title }}</b>
              <p>{{ card.description }}</p>
            </div>
          </div>


and such styles (pseudo-element):

&::before {
    position: absolute;
    content: "";
    background-image: ; // как передать?
    width: 100%;
    height: 100%;
  }


How can I pass an image name to css and end up with something like this:
../assets/Имя.svg?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question