I am using vue-cli and this is my code. It is working perfectly but what i want to do is list them as array with v-for and not manually as below. I don't know how to match each item dynamically.
<template>
<div class="slides">
<div class="slide-1" :class="{active:selected == 1}">
<figure class="photo">
<img
src="https://images.unsplash.com/photo-1518235506717-e1ed3306a89b?ixlib=rb-1.2.1&auto=format&fit=crop&w=1500&q=80"
alt
>
</figure>
</div>
<div class="slide-2" :class="{active:selected == 2}">
<figure class="photo">
<img
src="https://images.unsplash.com/photo-1502602898657-3e91760cbb34?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1504&q=80"
alt
>
</figure>
</div>
<div class="slide-3" :class="{active:selected == 3}">
<figure class="photo">
<img
src="https://images.unsplash.com/photo-1474606030380-107829a22fc6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80"
alt
>
</figure>
</div>
</div>
<nav>
<h2><span @click="selected = 1" :class="{clicked:selected == 1}">new york</span></h2>
<h2><span @click="selected = 2" :class="{clicked:selected == 2}">paris</span></h2>
<h2><span @click="selected = 3" :class="{clicked:selected == 3}">london</span></h2>
</nav>
</template>
<script>
export default {
name: "app",
data() {
return {
selected: 1
}
}
};
</script>