Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
51
rated 0 times [  57] [ 6]  / answers: 1 / hits: 15365  / 7 Years ago, fri, september 8, 2017, 12:00:00

I have a <router-link to = / endreco / test>, but I need to perform the same behavior on a vue-material tab, something like this: <md-tab md- icon = books> .. to change my route, same as the href =



What should I do?



I'm using vue.js, the vue-router to control routes and style with vue-material


More From » vue.js

 Answers
18

See my code I have implemented a method which traverses to router to see routes of mentioned name of component, you can easily get idea!



<template>
<div>
<div class=mdl-grid>
<div class=mdl-cell mdl-cell--3-col mdl-cell mdl-cell--1-col-tablet mdl-cell--hide-phone></div>
<div class=mdl-cell mdl-cell--6-col mdl-cell--4-col-phone>
<div class=image-card v-for=picture in this.pictures @click=displaydetails(picture.id) >
<div class=image-card__picture>
<img :src=picture.url />
</div>
<div class=image-card__comment mdl-card__actions>
<span>{{ picture.comment }}</span>
</div>
</div>
</div>
</div>
<router-link class=add-picture-button mdl-button mdl-js-button mdl-button--fab mdl-button--colored to=/postview>
<i class=material-icons>add</i>
</router-link>
</div>
</template>
<script>
import data from '../data'
export default {
data() {
return{
'pictures' : data.pictures
}
},
methods :{
displaydetails (id){
this.$router.push({name:'detailview', params:{id:id}});
console.log(helo);
}
}
}
</script>


Hope get something resourceful out of it!


[#56536] Wednesday, September 6, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darleneh

Total Points: 231
Total Questions: 110
Total Answers: 94

Location: Spain
Member since Thu, Dec 23, 2021
3 Years ago
;