|
@@ -10,6 +10,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import pathToRegexp from 'path-to-regexp';
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -35,7 +37,7 @@ export default {
|
|
|
const first = matched[0];
|
|
|
|
|
|
if (!this.isDashboard(first)) {
|
|
|
- matched = [{ path: '/homeIndex', meta: { title: '系统首页' } }].concat(matched);
|
|
|
+ matched = [{ path: '/homeIndex', redirect: '/homeIndex', meta: { title: '系统首页' } }].concat(matched);
|
|
|
}
|
|
|
|
|
|
this.levelList = matched.filter((item) => item.meta && item.meta.title && item.meta.breadcrumb !== false);
|
|
@@ -45,7 +47,13 @@ export default {
|
|
|
if (!name) {
|
|
|
return false;
|
|
|
}
|
|
|
- return name.trim() === 'homeIndex';
|
|
|
+ return name.trim().toLocaleLowerCase() === 'HomeIndex'.toLocaleLowerCase();
|
|
|
+ },
|
|
|
+ pathCompile(path) {
|
|
|
+ // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
|
|
|
+ const { params } = this.$route;
|
|
|
+ var toPath = pathToRegexp.compile(path);
|
|
|
+ return toPath(params);
|
|
|
},
|
|
|
handleLink(item) {
|
|
|
const { redirect, path } = item;
|
|
@@ -53,7 +61,7 @@ export default {
|
|
|
this.$router.push(redirect);
|
|
|
return;
|
|
|
}
|
|
|
- this.$router.push(path);
|
|
|
+ this.$router.push(this.pathCompile(path));
|
|
|
},
|
|
|
},
|
|
|
};
|