@Iskra_Kulak

Как убрать hashbang c vue-router?

Я убрал # по этой инструкции https://router.vuejs.org/guide/essentials/history-...
И частично она работает, если переходить на другие страницы test.wgtest.pp.ua/presidium, test.wgtest.pp.ua/calendarevent.
Но если я перейду на этой странице test.wgtest.pp.ua/calendarevent в саму новость, то при перезагрузке этой страницы, там пусто test.wgtest.pp.ua/details/1

router.js
Vue.use(Router)
export default new Router({
mode: 'history',
// hash: false,
routes: [
{
path: '/',
name: 'home',
component: home
},
{
path: '/bmo',
name: 'bmo',
component: blog
},
{
path: '/calendarevent/',
name: 'calendarevent',
component: calendarevent
},
{
path: '/contact',
name: 'contact',
component: contact
},
{
path: '/details/:Pid',
name: 'details',
component: details
},
{
path: '/presidium',
name: 'presidium',
component: presidium
}
]
})

.htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]


CalendarVue.vue



loading="lazy"
width="360"
height="202"
:src="item.image"
alt=""
/>
......
  • Вопрос задан
  • 133 просмотра
Решения вопроса 1
Aetae
@Aetae Куратор тега Vue.js
Тлен
У тебя publicPath относительный, а для history нужен абсолютный.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы