<template>
<div :class="['item','banner-bg-'+(index%3+1)]">
<div class="title">{{title(item.bannerName)}}</div>
<div class="content">{{content(item.bannerName)}}</div>
<div v-if="item.bannerUrl" @click="openUrl(item.bannerUrl)" class="btn">查看详情</div>
</div>
</template>
<style lang="less">
.banner-bg(@index) {
background: url(~'./banner@{index}.png') no-repeat;
background-size: 100% 100%;
}
<style>
vue 动态引用背景图片
最新推荐文章于 2024-08-30 17:33:11 发布