Dom节点定义数据

1
2
3
4
5
6
7
<!-->Yo, this is for a Vue project<-->
<div class="test-div" :vote-badge="`${blog.voteCount}`"></div>

<div
class="test-div1"
:style="{'--item-count':item.count}"
:vote-badge="`${blog.voteCount}`"></div>
1
2
3
4
5
6
7
.test-div:after {
content: attr(vote-badge);
}

.test-div1 {
height: calc(var(--item-count) * 40px);
}