Browse Source

nástřel kolotoče

master
Jméno Příjmení 4 years ago
parent
commit
2c860ac370
  1. BIN
      public/img/image_01.jpg
  2. BIN
      public/img/image_02.jpg
  3. BIN
      public/img/image_03.jpg
  4. 53
      src/App.vue

BIN
public/img/image_01.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

BIN
public/img/image_02.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

BIN
public/img/image_03.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

53
src/App.vue

@ -1,28 +1,57 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<h1>Kolotoč</h1>
<div>
<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="img.title" v-bind:class="{active: i == index}"></button>
</div>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
data: function() {
return {
index: 0,
images: [
{
src: "/img/image_01.jpg",
title: "Obrázek 1"
},
{
src: "/img/image_02.jpg",
title: "Obrázek 2"
},
{
src: "/img/image_03.jpg",
title: "Obrázek 3"
}
],
}
},
watch: {
index: function(value) {
let total = this.images.length - 1;
if (value < 0) {
this.index = total;
}
else if (value > total) {
this.index = 0;
}
}
}
}
</script>
<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>

Loading…
Cancel
Save