Fix router generation for page names containing @/~

This commit is contained in:
abalabahaha 2017-12-03 12:37:03 -08:00 committed by Pooya Parsa
parent 5f57166feb
commit 704e7cd7d9
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import Vue from 'vue'
import NuxtChild from './nuxt-child'
import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.includes('~') || components.ErrorPage.includes('@')) ? components.ErrorPage : "../" + components.ErrorPage) : "./nuxt-error.vue" %>'
import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.indexOf('~') === 0 || components.ErrorPage.indexOf('@') === 0) ? components.ErrorPage : "../" + components.ErrorPage) : "./nuxt-error.vue" %>'
import { compile } from '../utils'
export default {

View File

@ -118,7 +118,7 @@ export function r() {
let args = Array.prototype.slice.apply(arguments)
let lastArg = _.last(args)
if (lastArg.includes('@') || lastArg.includes('~')) {
if (lastArg.indexOf('@') === 0 || lastArg.indexOf('~') === 0) {
return wp(lastArg)
}
@ -133,7 +133,7 @@ export function relativeTo() {
let path = r(...args)
// Check if path is an alias
if (path.includes('@') || path.includes('~')) {
if (path.indexOf('@') === 0 || path.indexOf('~') === 0) {
return path
}