Fix issue with missing poster
This commit is contained in:
parent
84b32579ef
commit
37074d60f1
16
index.html
16
index.html
@ -41,6 +41,14 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.poster {
|
||||||
|
height: 392px;
|
||||||
|
width: 276px;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: gray;
|
||||||
|
margin: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.no-bullet {
|
.no-bullet {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
@ -77,7 +85,7 @@
|
|||||||
<div v-else>
|
<div v-else>
|
||||||
<ul v-if="step == 2" class="no-bullet">
|
<ul v-if="step == 2" class="no-bullet">
|
||||||
<li v-for="(item, index) in searchItems">
|
<li v-for="(item, index) in searchItems">
|
||||||
<img class="pointer" v-bind:src="item.poster_url" v-bind:alt="item.title" v-on:click="() => loadItem(index)" />
|
<img class="pointer poster" v-bind:src="item.poster_url" v-bind:alt="item.title" v-on:click="() => loadItem(index)" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
@ -257,11 +265,15 @@ var app = new Vue({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.searchItems = response.items.map((item) => {
|
this.searchItems = response.items.map((item) => {
|
||||||
|
var poster = null;
|
||||||
|
if (item['poster']) {
|
||||||
|
poster = item['poster'].replace('{profile}', 's276');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
type: item.object_type,
|
type: item.object_type,
|
||||||
poster_url: `https://images.justwatch.com${item['poster'].replace('{profile}', 's276')}`
|
poster_url: `https://images.justwatch.com${poster}`
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.step += 1;
|
this.step += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user