create vue-link-formatter module, integrated home link fields into vuejs
This commit is contained in:
@ -26,6 +26,27 @@ export default {
|
||||
}else{
|
||||
return this.template.render.call(this)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickLink(e){
|
||||
console.log("onClickLink", e, this.$router);
|
||||
let path = null;
|
||||
|
||||
this.$router.options.routes.forEach(route => {
|
||||
// console.log('route.path', route.path);
|
||||
if (route.path == e.originalTarget.pathname) {
|
||||
path = e.originalTarget.pathname
|
||||
// TODO: check if path is current
|
||||
// TODO: as we can't break forEach is not the good method here
|
||||
}
|
||||
}, this)
|
||||
|
||||
if (path) {
|
||||
this.$router.push({
|
||||
path: path
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user