55 lines
1.6 KiB
Plaintext
55 lines
1.6 KiB
Plaintext
<compofilm>
|
|
<a if="{state.visible && state.film!=null}" target="blanc" href="https://www.themoviedb.org/movie/{state.film.id}?language=fr">{state.film.title}</a>
|
|
<img if="{state.film!=null && state.film.poster_path!=null}" src="https://image.tmdb.org/t/p/original{state.film.poster_path}" width="100%"/>
|
|
<i class="fa-solid fa-star" each={ i in Array(10).keys() } if="{ state.visible && state.film!=null && state.film.vote_average>=i+1 }"></i>
|
|
<i class="fa-regular fa-star-half-stroke" each={ i in Array(10).keys() } if="{state.visible && state.film!=null && state.film.vote_average>=i+0.5 && state.film.vote_average<i+1}"></i>
|
|
<i class="fa-regular fa-star tamer" each={ i in Array(10).keys() } if="{state.visible && state.film!=null && state.film.vote_average>=i && state.film.vote_average<i+0.5}"></i>
|
|
<i class="fa-regular fa-star" each={ i in Array(10).keys() } if="{ state.visible && state.film!=null && state.film.vote_average<i }"></i>
|
|
<span if="{state.visible && state.film!=null}">{state.film.vote_average}</span>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
state: {
|
|
loading: false,
|
|
error: null,
|
|
film: null,
|
|
visible: true
|
|
},
|
|
reset() {
|
|
this.update({
|
|
loading: false,
|
|
error: null,
|
|
film: null,
|
|
visible: true
|
|
})
|
|
},
|
|
onBeforeMount (props,state){
|
|
|
|
state.film=props.v_film;
|
|
props.v_setVisiSetter(this.setVisi);
|
|
props.v_setFilmSetter(this.setFilm);
|
|
},
|
|
setVisi(visible){
|
|
this.state.visible=visible;
|
|
this.update();
|
|
},
|
|
setFilm(film){
|
|
this.state.film=film;
|
|
this.update();
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style>
|
|
*{
|
|
display: block;
|
|
}
|
|
|
|
compofilm{
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
|
|
</compofilm> |