-
Notifications
You must be signed in to change notification settings - Fork 9
/
vue.config.js
35 lines (33 loc) · 963 Bytes
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const baseUrl = '/'
module.exports = {
devServer: {
host: '0.0.0.0',
port: 80,
// https: false,
// hotOnly: false,
// open: true,
// disableHostCheck: true,
before: function(app) {
const base = baseUrl.replace(/\/+$/, '') // 移除尾部斜杠
app.get(`${base}/:page/*`, function(req, res, next) {
if (['login', 'index'].includes(req.params.page)) {
// 把 /<base>/<page>/* 重定向到 /<base>/<page>/
req.url = `${base}/${req.params.page}/`
next('route')
} else {
next()
}
})
}
},
pages: {
login: {
entry: 'src/pages/login/login.main.js',
template: 'public/login.html'
},
index: {
entry: 'src/main.js',
template: 'public/index.html'
}
}
}