You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.2 KiB
61 lines
1.2 KiB
<template>
|
|
<div id="app">
|
|
<h1>Kolotoč</h1>
|
|
<button v-on:click="index -= 1"><</button>
|
|
<button v-on:click="index += 1">></button>
|
|
<div>
|
|
{{ images[index].src }}<br>
|
|
{{ images[index].title }}
|
|
</div>
|
|
<button v-on:click="index = i" v-for="(img, i) in images" :key="i" :title="image.title></button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
name: 'App',
|
|
data: function() {
|
|
return {
|
|
image: [
|
|
{
|
|
src: "/images/image_01.jpg",
|
|
title: "titulek",
|
|
text:"Lorem upsum dolor sit amet"
|
|
},
|
|
{
|
|
src: "images/image_02.jpg",
|
|
title: "titulek",
|
|
text:"Lorem upsum dolor sit amet"
|
|
},
|
|
{
|
|
src: "images/image_03.jpg",
|
|
title: "titulek",
|
|
text:"Lorem upsum dolor sit amet"
|
|
}
|
|
],
|
|
index: 0
|
|
}
|
|
},
|
|
methods: {
|
|
|
|
},
|
|
watch: {
|
|
index: function(value) {
|
|
let total = this.images.lenght - 1;
|
|
if (value < 0) {
|
|
this.index = 0;
|
|
}
|
|
else if (value > total) {
|
|
this.index = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.active {
|
|
background-color: green;
|
|
}
|
|
</style>
|
|
|