1、初始化工程:yarn create vite xxx(项目名) --template vue-ts
2、添加:ui/axios/路由:yarn add ant-design-vue axios vue-router
3、 main.ts:
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
app.use(Antd)
4、配置vite:
export default defineConfig({
plugins: [vue()],
server:{
port:3008,
open:true,
host:'0.0.0.0',
cors:true,
proxy:{
'/api': {
target: 'http://192.168.3.8:8088',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
}
}
})
5、