feat::自定义路由

This commit is contained in:
hackrobot
2024-09-26 08:43:29 +08:00
parent 0cfcd0c718
commit bfebed2a2c
2 changed files with 23 additions and 22 deletions

View File

@@ -42,14 +42,15 @@ const config = {
},
},
h5: {
webpackChain (chain) {
webpackChain(chain) {
chain.module
.rule('markdown')
.rule("markdown")
.test(/\.md$/)
.use('raw-loader')
.loader('raw-loader')
.end();
.use("raw-loader")
.loader("raw-loader")
.end();
},
esnextModules: ["taro-ui"],
publicPath: "/",
staticDirectory: "static",
@@ -66,17 +67,19 @@ const config = {
},
},
},
// customRoutes: {
// // "页面路径": "自定义路由"
// "/pages/index/index": "/index",
// // '/pages/detail/index': ['/detail'], // 可以通过数组为页面配置多个自定义路由
// "pages/my/index": "/my",
// "pages/meetup/index": "/meetup",
// "pages/meetup/Detail/index": "/detail",
// },
router: {
// basename: '/myapp',
mode: "hash", // 或者是 'browser'
// mode: "hash", // 或者是 'browser'
mode: "browser", // 或者是 'browser'
customRoutes: {
// "页面路径": "自定义路由"
"/pages/index/index": "/",
// '/pages/detail/index': ['/detail'], // 可以通过数组为页面配置多个自定义路由
"pages/my/index": "/my",
"pages/meetup/index": "/meetup",
"pages/meetup/Detail/index": "/detail",
},
},
// defineConstants: {
// HOST: '"/api"'
@@ -85,20 +88,20 @@ const config = {
// host: 'nomad.hackrobot.cn', // 替换为您的域名
// port: 10087, // 选择一个适当的端口号
proxy: {
'/api/': {
"/api/": {
target: JSON.parse('"http://localhost:8700"'), //本地调试端口
pathRewrite: {
'^/api/': '/'
"^/api/": "/",
},
changeOrigin: true
}
changeOrigin: true,
},
},
// 允许特定域名访问
allowedHosts: [
// 'bot.hackrobot.cn'
"www.digitalnomadchina.com"
"www.digitalnomadchina.com",
],
}
},
},
};

View File

@@ -7,8 +7,6 @@ export default {
'pages/group/index',
'pages/book/index',
'pages/salon/index',
],
window: {
backgroundTextStyle: 'light',