I am creating a VueJS app which heavily uses the vue router.
Here\'s the structure of my routes.js
:
export const routes = [
{ path:
vue-router uses path-to-regexp as its path matching engine, so it supports many advanced matching patterns such as optional dynamic segments, zero or more / one or more requirements, and even custom regex patterns.
So change your route definition as follows:
{ path: 'poetry/:id(\\d+)', name: 'poetrycard', component: PoetryCard }
Reference- Advanced Matching patterns