refactored home database materials
This commit is contained in:
@ -29,17 +29,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
onClickLink(e){
|
||||
console.log("onClickLink", e, this.$router);
|
||||
console.log("onClickLink", e, this.$router, this.$route);
|
||||
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
|
||||
// find existing router route compared with link href
|
||||
for (var i = 0; i < this.$router.options.routes.length; i++) {
|
||||
if (this.$router.options.routes[i].path == e.originalTarget.pathname) {
|
||||
if (e.originalTarget.pathname !== this.$route.path) {
|
||||
path = e.originalTarget.pathname
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
|
||||
if (path) {
|
||||
this.$router.push({
|
||||
|
Reference in New Issue
Block a user