Interface change
You should pass object for your config instead of function params. This allows vue-book to add more options without breaking changes.
Here's the recommended way:
import Router from 'vue-router'
import { createRoute } from 'vue-book'
const router = new Router({
routes: [
createRoute({
requireContext: require.context('./..', true, /.demo.vue$/),
path: '/demo',
hideFileExtensions: true,
}),
]
})
Before the change, you created the route like this:
VueBook(require.context('./../tree', true, /.vue$/), '/demo')
Deprecation is soft, so nothing will break for now. : 3.
Optional remove extension
You can remove file extensions from the list with hideFileExtensions
. By default it's set to false
.
createRoute({
// ...
hideFileExtensions: true,
}),