[Vuejs]-VueRouter doesn't work properly in history mode – WordPress

0👍

Define publicPath: '/' in your routes file. Hope it works.

import Vue from 'vue';
import Router from 'vue-router';
import Main from '../Components/Main';
import ArticlePage from '../Components/ArticlePage';
import Page from '../Components/Page';

Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            publicPath: '/',
            name: 'Main',
            component: Main
        },
        {
            path: '/post/:url',
            publicPath: '/',
            name: 'ArticlePage',
            component: ArticlePage
        },
        {
            path: '/page/:url',
            publicPath: '/',
            name: 'Page',
            component: Page
        }
    ],

});

Leave a comment