Adam Písař 4 years ago
parent
commit
87d68faf75
  1. BIN
      public/images/image_01.jpg
  2. BIN
      public/images/image_02.jpg
  3. BIN
      public/images/image_03.jpg
  4. 57
      src/App.vue

BIN
public/images/image_01.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

BIN
public/images/image_02.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

BIN
public/images/image_03.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

57
src/App.vue

@ -1,28 +1,61 @@
<template> <template>
<div id="app"> <div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<h1>Kolotoč</h1>
<button v-on:click="index -= 1">&lt;</button>
<button v-on:click="index += 1">&gt;</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> </div>
</template> </template>
<script> <script>
import HelloWorld from './components/HelloWorld.vue'
export default { export default {
name: 'App', name: 'App',
components: {
HelloWorld
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> </script>
<style> <style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
.active {
background-color: green;
} }
</style> </style>

Loading…
Cancel
Save