Browse Source

swiper-新书推荐

master
xuhuajiao 2 years ago
parent
commit
2e4e91e4c5
  1. 2
      src/router/index.js
  2. 20
      src/views/newBookRecommend.vue

2
src/router/index.js

@ -25,7 +25,7 @@ const routes = [
name: 'LibraryIntroduction', name: 'LibraryIntroduction',
component: () => import('../views/libraryIntroduction.vue'), component: () => import('../views/libraryIntroduction.vue'),
meta: { meta: {
title: '图书简介'
title: '图书简介'
} }
}, },
{ {

20
src/views/newBookRecommend.vue

@ -48,7 +48,6 @@ export default {
this.getBookList() this.getBookList()
}, },
mounted() { mounted() {
this.initSwiper()
}, },
methods: { methods: {
initSwiper() { initSwiper() {
@ -72,8 +71,9 @@ export default {
getBookList() { getBookList() {
FetchNewBookRecommend().then(res => { FetchNewBookRecommend().then(res => {
console.log(res, 'res') console.log(res, 'res')
this.rankingList = res.data
this.rankingList.forEach(item => {
let data = []
data = res
data.forEach(item => {
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item) this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
}) })
}).catch(() => { }).catch(() => {
@ -85,8 +85,9 @@ export default {
isbn: isbn isbn: isbn
} }
FetchCoverByISBN(params).then((res) => { FetchCoverByISBN(params).then((res) => {
console.log(res, 'blob')
item.cover = window.URL.createObjectURL(res) item.cover = window.URL.createObjectURL(res)
this.rankingList.push(item)
this.initSwiper()
}) })
} }
} }
@ -108,12 +109,10 @@ export default {
} }
.book-img{ .book-img{
height: 6.575rem; height: 6.575rem;
line-height: 6.575rem;
img{ img{
// display: block;
display: block;
width: 100%; width: 100%;
// height: 100%;
vertical-align: middle;
height: 100%;
} }
} }
.book-info{ .book-info{
@ -128,15 +127,12 @@ export default {
} }
} }
.icon{
height: 1.1em;
}
.prev-btn, .prev-btn,
.next-btn{ .next-btn{
position: absolute; position: absolute;
bottom: 60px; bottom: 60px;
font-size: 60px; font-size: 60px;
// color: #71C09E;
color: #71C09E;
z-index: 999; z-index: 999;
} }

Loading…
Cancel
Save