ciao!
alla fine dovrò pubblicare il progetto in una sotto cartella.
quindi ho fatto così:
codice:
// vue.config.js
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/sport' : '/sport'
}
questo il mio router.js:
codice:
import {createRouter, createWebHistory} from 'vue-router';
import Dashboard from './components/Dashboard.vue';
import Allenamenti from "@/components/Allenamenti";
import AggiungiAllenamento from "@/components/AggiungiAllenamento";
const routes = [
{
path: '/',
name: 'dashboard',
component: Dashboard,
},
{
path: '/allenamenti',
name: 'allenamenti',
component: Allenamenti,
},
{
path: '/aggiungi/:id?',
name: 'aggiungi',
component: AggiungiAllenamento,
}
];
const router = createRouter({
history: createWebHistory(),
routes
});
export default router;
e poi ho aggiunto il base nell'index.html.
funziona quasi tutto, tranne quando faccio questo:
codice:
router.push({name: '/aggiungi', params: {id: info.event.id}})
solo che prima di impostare la sottodirectory funionava!
qualche idea??