Skip to content

Commit ce8eb54

Browse files
Merge pull request #5 from tutorcruncher/hash-url-fix
fixing urls with hash
2 parents a70ea68 + 7c2ca11 commit ce8eb54

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ Vue.use(VueRouter)
3030

3131
const ConfiguredVueRouter = config => {
3232
const routes = []
33+
const url_base = config.router_mode === 'history' ? config.url_root : '/'
3334
if (config.mode === 'grid') {
3435
routes.push(
3536
{
36-
path: config.url_root + ':type(s|q)?/:link(\\d+-[\\w-]+)?',
37+
path: url_base + ':type(s|q)?/:link(\\d+-[\\w-]+)?',
3738
name: 'index',
3839
component: grid,
3940
children: [
4041
{
41-
path: config.url_root + ':link(\\d+-[\\w-]+)',
42+
path: url_base + ':link(\\d+-[\\w-]+)',
4243
name: 'con-modal',
4344
component: con_modal,
4445
}
@@ -48,20 +49,20 @@ const ConfiguredVueRouter = config => {
4849
} else if (config.mode === 'enquiry') {
4950
routes.push(
5051
{
51-
path: config.url_root,
52+
path: url_base,
5253
name: 'index',
5354
component: enquiry,
5455
},
5556
)
5657
} else if (config.mode === 'enquiry-modal') {
5758
routes.push(
5859
{
59-
path: config.url_root,
60+
path: url_base,
6061
name: 'index',
6162
component: enquiry_button,
6263
children: [
6364
{
64-
path: config.url_root + 'enquiry',
65+
path: url_base + 'enquiry',
6566
name: 'enquiry-modal',
6667
component: enquiry_modal,
6768
}

0 commit comments

Comments
 (0)