vastsa / FileCodeBox

文件快递柜-匿名口令分享文本,文件,像拿快递一样取文件(FileCodeBox - File Express Cabinet - Anonymous Passcode Sharing Text, Files, Like Taking Express Delivery for Files)
https://share.lanol.cn
GNU Lesser General Public License v3.0
4.02k stars 499 forks source link

可否修改router\index.ts中的一个代码,去掉访问后URL带上的`#`号 #175

Closed Suery closed 4 months ago

Suery commented 4 months ago

fcb-fronted\src\router\index.ts

import { createRouter, createWebHashHistory } from 'vue-router';

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/Share/HomeView.vue'),
    },
    {
      path: '/send',
      name: 'send',
      component: () => import('@/views/Share/SendView.vue'),
    },
    {
      path: '/admin',
      name: 'admin',
      component: () => import('@/views/Admin/AdminView.vue'),
      children:[
        {
          path: '',
          name: 'file',
          component: () => import('@/views/Admin/FileView.vue'),
        },
        {
          path: 'setting',
          name: 'setting',
          component: () => import('@/views/Admin/SettingView.vue'),
        },
        {
          path: 'about',
          name: 'about',
          component: () => import('@/views/Admin/AboutView.vue'),
        },
      ]
    }
  ],
});

export default router;

修改为

import { createRouter, createWebHistory } from 'vue-router';

const router = createRouter({
  history: createWebHistory (import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/Share/HomeView.vue'),
    },
    {
      path: '/send',
      name: 'send',
      component: () => import('@/views/Share/SendView.vue'),
    },
    {
      path: '/admin',
      name: 'admin',
      component: () => import('@/views/Admin/AdminView.vue'),
      children:[
        {
          path: '',
          name: 'file',
          component: () => import('@/views/Admin/FileView.vue'),
        },
        {
          path: 'setting',
          name: 'setting',
          component: () => import('@/views/Admin/SettingView.vue'),
        },
        {
          path: 'about',
          name: 'about',
          component: () => import('@/views/Admin/AboutView.vue'),
        },
      ]
    }
  ],
});

export default router;
vastsa commented 4 months ago

去掉之后又需要在nginx反代多加一条,否则刷新就会404

Suery commented 4 months ago

去掉之后又需要在nginx反代多加一条,否则刷新就会404

try_files $uri $uri/ /index.html;是这个不?如果是这个的话不用的

vastsa commented 4 months ago

去掉之后又需要在nginx反代多加一条,否则刷新就会404

try_files $uri $uri/ /index.html;是这个不?如果是这个的话不用的

是的哟

Suery commented 4 months ago

去掉之后又需要在nginx反代多加一条,否则刷新就会404

try_files $uri $uri/ /index.html;是这个不?如果是这个的话不用的

是的哟

不需要的,我在另外一个nodejs+nginx部署的项目测试了

vastsa commented 4 months ago

去掉之后又需要在nginx反代多加一条,否则刷新就会404

try_files $uri $uri/ /index.html;是这个不?如果是这个的话不用的

是的哟

不需要的,我在另外一个nodejs+nginx部署的项目测试了

好滴,等我测试一下哦

Suery commented 4 months ago

去掉之后又需要在nginx反代多加一条,否则刷新就会404

try_files $uri $uri/ /index.html;是这个不?如果是这个的话不用的

是的哟

不需要的,我在另外一个nodejs+nginx部署的项目测试了

好滴,等我测试一下哦

OK,感谢大佬回复

vastsa commented 4 months ago

经测试不行,你之所以行应该是node,我这个已经是build之后的,你可以试一下

image
Suery commented 4 months ago

我试了下,build后部署,确实不行,首页是可以访问,但是点击上传页面就404了