vue代码
<template>
<div class="index">
<!-- 遍历 -->
<div v-for="(item, index) in catalogue" :key="index">
<!-- 页面跳转 -->
<!-- <router-link :to="{path:'/book',query:{levels:item.levels}}"> -->
<div class="boxtop" style="background-color: #ffffff;">
<div class="boxright">{{item.catalogueName}}</div>
<div class="box" style="background-color: #ffffff;">
<div class="boxtext">{{index}}</div>
</div>
</div>
<!-- </router-link> -->
</div>
</div>
</template>
<script>
import axios from "axios";
export default {
mounted() {
this.findAll();
},
name: "MyApp",
data() {
return {
catalogue: [
{
levels: "level1-1",
catalogueName: "Good morning.",
book: {
levels: "level1-1",
bookUrl: "http://lya.ntgyou.cn/m/11128-22060Q644557.jpg"
}
},
{
levels: "level1-1",
catalogueName: "Helloween.",
book: {
levels: "level1-1",
bookUrl: "http://lya.ntgyou.cn/m/11128-22060Q644557.jpg"
}
}
]
};
},
methods: {
findAll() {}
}
};
</script>
<style scoped>
.register {
/* //固定外层盒子,不受其他盒子影响
//放在最底层 */
position: fixed;
top: 0;
left: 0;
z-index: -1;
}
.link_1:hover {
background: #d0ff00;
}
.link_4:hover {
color: #2216d1;
}
.link_2:hover {
font-size: 300px;
}
.link_3:hover {
background: #d0ff00;
}
.image {
width: 320px;
height: 100px;
}
.box {
box-shadow: 0 0 1px 3px #ecc206;
margin-top: -83px;
height: 90px;
width: 90px;
margin-left: -55px;
/* 圆形 */
border-radius: 50%;
font-size: 50px;
font-weight: 1000;
text-align: center;
}
.boxtext {
line-height: 85px;
display: inline-block;
color: rgba(8, 27, 241, 0.882);
text-align: center;
}
.box-text {
font-size: 12px;
}
.boxtop {
box-shadow: 0 0 1px 3px #d81c1c;
/* 给父盒子设置相对定位 */
position: relative;
width: 300px;
height: 80px;
/* 让父盒子水平居中 */
/* margin: 0 auto; */
margin-left: 50px;
margin-top: 30px;
/* 边框圆角 */
border-top-right-radius: 10px;
/* border-top-left-radius:10px; */
border-bottom-right-radius: 10px;
/* border-bottom-left-radius:10px; */
}
.index {
/* 给父盒子设置相对定位 */
position: relative;
width: 360px;
height: 85px;
/* 让父盒子水平居中 */
margin: 0 auto;
margin-top: 30px;
}
.boxright {
display: flex;
/* box-shadow: 0 0 1px 3px #ecc206; */
width: 240px;
height: 80px;
margin-left: 50px;
justify-content: center;
align-items: center;
color: rgba(8, 27, 241, 0.882);
font-weight: 1000;
font-size: 20px;
}
</style>
效果
![]()