Skip to content

Instantly share code, notes, and snippets.

@basebandit
Created June 23, 2018 12:32
Show Gist options
  • Save basebandit/d6c1e3b4c6f7db474cf0d1406b98b27e to your computer and use it in GitHub Desktop.
Save basebandit/d6c1e3b4c6f7db474cf0d1406b98b27e to your computer and use it in GitHub Desktop.
Dynamic routing with router params
<template>
...
<template v-if="countMemories !== 0">
<v-list two-line>
<template v-for="(memory, index) in memories">
<v-list-tile :to="{path: '/event/' + memory.title}" :key="memory.title" avatar>
<v-list-tile-avatar v-if="!memory.done">
<img src="../assets/memory.png">
</v-list-tile-avatar>
<v-list-tile-avatar v-else>
<img src="../assets/done.png">
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title>
{{memory.title}}
</v-list-tile-title>
<v-list-tile-sub-title>
{{memory.description}} </v-list-tile-sub-title>
<v-list-tile-sub-title>
<span class="grey--text text--lighten-1 ">
{{memory.createdDate}}
</span>
</v-list-tile-sub-title>
</v-list-tile-content>
<v-list-tile-action>
<v-btn flat icon color="warning" @click="removeMemory(index)">
<v-icon>clear</v-icon>
</v-btn>
</v-list-tile-action>
</v-list-tile>
<v-divider v-if="(index + 1) < countMemories" :key="`divider-${index}`"></v-divider>
</template>
...
</template>
<script>
import moment from 'moment'
import { mapState, mapGetters } from 'vuex'
import VuePerfectScrollbar from 'vue-perfect-scrollbar'
export default {
name: 'Sidebar',
...
methods: {
...
navigateTo (route) {
this.$router.push(route)
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment