css伪类中content使用变量

<template>
  <div :class="[ns.b()]" :data-attr="props.title">
    <div :class="[ns.e('body')]">
      <slot></slot>
    </div>
  </div>
</template>

.sc-cardTitle::after {
  content: attr(data-attr);
  width: 100px;
  position: absolute;
  top: 13px;
  left: 10px;
  color: #3f3f3f;
  font-size: 18px;
  font-weight: 900;
}

你可能感兴趣的:(css,前端,vue3)