Technology Sharing

Andt Desgin Vue Pro project adds prefix access solution

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina


Preface

Our front-end is a project developed by antd design vue pro. Previously, we could
Access it at https://abc.test.io. Now multiple projects use one domain name. The current requirement is to use https://abc.test.io/admin to access it. The modification process is recorded here. This front-end framework is similar and should be referenced.


1. Project code modification

vue.config.js sets publicPath

The publicPath option can be used to set the access path prefix of the vue.js project. For example, our project needs to be accessed with the prefix /a

  // 区分开发和打包分别配置,打包配置的值和nginx配置的保持一致
  publicPath: process.env.NODE_ENV == 'development' ? '/admin' 
  • 1