diff --git a/lib/app/Content.js b/lib/app/Content.js index 4b3b4c88f5..79051a85dc 100644 --- a/lib/app/Content.js +++ b/lib/app/Content.js @@ -1,5 +1,3 @@ -import { pathToComponentName } from './util' - export default { functional: true, @@ -11,7 +9,7 @@ export default { }, render (h, { parent, props, data }) { - return h(pathToComponentName(parent.$page.path), { + return h(parent.$page.name, { class: [props.custom ? 'custom' : '', data.class, data.staticClass], style: data.style }) diff --git a/lib/app/util.js b/lib/app/util.js index ceafb220c6..f0904ef0ee 100644 --- a/lib/app/util.js +++ b/lib/app/util.js @@ -5,15 +5,8 @@ export function injectMixins (options, mixins) { options.mixins.push(...mixins) } -export function pathToComponentName (path) { - if (path.charAt(path.length - 1) === '/') { - return `page${path.replace(/\//g, '-') + 'index'}` - } else { - return `page${path.replace(/\//g, '-').replace(/\.html$/, '')}` - } -} - export function findPageForPath (pages, path) { + path = decodeURIComponent(path) for (let i = 0; i < pages.length; i++) { const page = pages[i] if (page.path === path) { diff --git a/lib/default-theme/Layout.vue b/lib/default-theme/Layout.vue index 9e54d0f248..44c600a63e 100644 --- a/lib/default-theme/Layout.vue +++ b/lib/default-theme/Layout.vue @@ -27,7 +27,6 @@ import Home from './Home.vue' import Navbar from './Navbar.vue' import Page from './Page.vue' import Sidebar from './Sidebar.vue' -import { pathToComponentName } from '@app/util' import store from '@app/store' import { resolveSidebarItems } from './util' import throttle from 'lodash.throttle' @@ -94,7 +93,7 @@ export default { nprogress.configure({ showSpinner: false }) this.$router.beforeEach((to, from, next) => { - if (to.path !== from.path && !Vue.component(pathToComponentName(to.path))) { + if (to.path !== from.path && !Vue.component(to.name)) { nprogress.start() } next() diff --git a/lib/default-theme/SidebarLink.vue b/lib/default-theme/SidebarLink.vue index 894aeaff41..10b795f10a 100644 --- a/lib/default-theme/SidebarLink.vue +++ b/lib/default-theme/SidebarLink.vue @@ -1,5 +1,5 @@