Vue.js 在URL中添加一个slug

Vue.js 在URL中添加一个slug,vue.js,iis,vue-router,Vue.js,Iis,Vue Router,我正在IIS中主持一个Vue SPA 我正在使用VueRouter,在我的路线中,我有: const routes = [ { path: '/', name: 'Home', component: Home }, { path: '/customers', name:'customers', component: Customers }, { path: '/qadcustomers', name:'qadcustomers', component: QadCustom

我正在IIS中主持一个Vue SPA

我正在使用VueRouter,在我的路线中,我有:

const routes = [
    { path: '/', name: 'Home', component: Home },
    { path: '/customers', name:'customers', component: Customers },
    { path: '/qadcustomers', name:'qadcustomers', component: QadCustomers },
    { path: '/customer/:id?', name:'customer', component: Customer, props: true },
    { path: '/qadcustomer/:id?', name:'qadcustomer', component: QadCustomer, props: true },
    { path: '/import', name:'import', component: Import },
];
在web服务器中,我将文件放入目录:
inetpub/wwwroot/dev/myapplication

我希望通过以下方式访问该应用程序:

https://myserver/dev/myapplication/
您可以使用

它将为所有路由添加
/dev/myapplication
前缀

因此,您的路线将如下所示:

  • /dev/myapplication/route1
  • /dev/myapplication/route2
  • /dev/myapplication/route3

尝试在构造函数中使用基本选项:

类型:字符串

默认值:“/”

应用程序的基本URL。例如,如果在/app/下提供整个单页应用程序,则base应使用值“/app/”


尝试使用构造函数@JalpaPanchal中的base选项,谢谢!不知道有“基本”选项。我最终还是用了这个建议。如果您的问题得到解决,那么我请求您将有用的建议标记为答案。这将帮助其他面临同样问题的人。
const router = new VueRouter({
  routes: [
    {
      path: '/dev/myapplication',
      component: MyApplication,
      children: [
        {
          path: 'route1',
          component: Route1
        },
        {
          path: 'route2',
          component: Route2
        }
...