Skip to content

Commit ac74dd5

Browse files
walterhu2020pi0
authored andcommitted
feat: add name property to routes (#58)
* fix: windows path issue
1 parent 9ea9072 commit ac74dd5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: lib/options.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ module.exports = function getOptions (_options) {
2323

2424
// Icons
2525
if (options.f7Icons) {
26-
options.f7IconsSrc = resolvePath('fonts/framework7-icons.css')
26+
options.f7IconsSrc = resolvePath('fonts/framework7-icons.css').replace(/\\/g, '\\\\')
2727
}
2828

2929
if (options.mdIcons) {
30-
options.mdIconsSrc = resolvePath('fonts/material-icons.css')
30+
options.mdIconsSrc = resolvePath('fonts/material-icons.css').replace(/\\/g, '\\\\')
3131
}
3232

3333
return options

Diff for: lib/templates/framework7/routes.js

+2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ function recursiveRoutes(routes, tab, components) {
1616
route.path = (route.path + '/').replace(/\/\/$/, '/')
1717
}
1818

19+
// add the router name
1920
route._name = '_' + hash(route.component)
2021
components.push({ _name: route._name, component: route.component, name: route.name, chunkName: route.chunkName })
2122
res += tab + '{\n'
23+
res += tab + ' name: ' + JSON.stringify(route.name) + ',\n'
2224
res += tab + ' path: ' + JSON.stringify(route.path) + ',\n'
2325
res += tab + ' component: ' + route._name
2426
res += (route.children) ? ',\n ' + tab + 'routes: [\n' + recursiveRoutes(routes[i].children, tab + ' ', components) + '\n ' + tab + ']' : ''

0 commit comments

Comments
 (0)