no message
Former-commit-id: 6c80c45adf2541bf0956803ff39949bbc6ec7cf4 Former-commit-id: a771e6e5a312afbfd5f591990fcced7851cc32eb Former-commit-id: cfe2dadb617e29d7ba9c6a4484a5426d47962b8f
This commit is contained in:
@@ -11,18 +11,17 @@ console.log(pathPosix)
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const path2Posix = pathString => pathString.split(pathPosix.sep).join('/')
|
||||
const win2posix = pathString => pathString.split('\\').join('/')
|
||||
|
||||
const routesMaker = ({publicPath, namePrefix, req}) => {
|
||||
return req.keys().map(req).map(page => {
|
||||
// 每个文件的路径
|
||||
const pagePath = pathPosix.dirname(page.default.__file)
|
||||
const pagePath = pathPosix.dirname(win2posix(page.default.__file))
|
||||
console.log('pagePath', pagePath)
|
||||
// 每个文件的路径 => posix 风格
|
||||
const pagePathPosix = path2Posix(pagePath)
|
||||
console.log('pagePathPosix', pagePathPosix)
|
||||
// 路由中使用的路径
|
||||
const path = pagePathPosix.replace(publicPath, '').replace(new RegExp(`${pathPosix.sep}page${pathPosix.sep}`, 'g'), pathPosix.sep)
|
||||
const path = pagePath
|
||||
.replace(win2posix(publicPath), '')
|
||||
.replace(new RegExp(`${pathPosix.sep}page${pathPosix.sep}`, 'g'), pathPosix.sep)
|
||||
console.log('path', path)
|
||||
const name = namePrefix + path.split(pathPosix.sep).join('-').replace(/-page-/g, '-')
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user