Estoy trabajando en vue y al ver las páginas, el enlace aparece de la siguiente manera:
http://localhost:8080/#/ http://localhost:8080/#/categorias¿Cómo lo elimino?
para que se vea asi?
http://localhost:8080/categorias http://localhost:8080/este es mi enrutador js
import { createRouter, createWebHashHistory } from 'vue-router' //import Home from '../views/Home.vue' import Inicio from '../components/Inicio.vue' const routes = [ { path: '/', name: 'inicio', component: Inicio }, { path: '/about', name: 'About', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') }, { path: '/categorias', name: 'Categorias', component: () => import(/* webpackChunkName: "about" */ '../components/Categorias.vue') }, { path: '/login', name: 'Login', component: () => import(/* webpackChunkName: "about" */ '../components/Login.vue') } ] const router = createRouter({ history: createWebHashHistory(), routes }) export default routerAgradezco cualquier ayuda gracias, ya que no he podido solucionarlo y es incomodo tener esa url de esa manera :D
Use createWebHistory ( modo HTML5 ) en lugar de createWebHashHistory ( modo hash )
import { createRouter, createWebHistory } from 'vue-router' ... const router = createRouter({ history: createWebHistory(), routes })vista
import VueRouter from 'vue-router' const router = new VueRouter({ routes, mode:'history' })nginx: cuando lo implementa en el servicio web (p. ej.: linux), muestra agregar esta configuración
server { listen 80; server_name localhost; server_name_in_redirect off; location / { root /etc/nginx/html; // deploy html path index index.html index.htm; if (-d $request_filename) { rewrite ^/(.*) /index.html break; } if (!-e $request_filename) { rewrite ^/(.*) /index.html break; } }