1

I'm building a multipage app using vue-cli. I want to implement a dynamic url like,

example.com/user/user1
example.com/user/user2
example.com/user/user3
...

How to implement this in vue.config.js file?

Currently, my vue.config.js file looks like this:

module.exports = {
    pages: {
      'homepage': {
        entry: './src/pages/Homepage/main.js',
        template: 'public/index.html',
        title: 'Homepage',
        chunks: [ 'chunk-vendors', 'chunk-common', 'homepage' ]
      },
      'about': {
        entry: './src/pages/About/main.js',
        template: 'public/about.html',
        title: 'About',
        chunks: [ 'chunk-vendors', 'chunk-common', 'about' ]
      },
      'user': {
        entry: './src/pages/User/main.js',
        template: 'public/index.html',
        title: 'User',
        chunks: [ 'chunk-vendors', 'chunk-common', 'user' ]
      }
    }
  }

I need an option like user/:id

Looking for feedback on how to implement such dynamic urls.

John Paul
  • 75
  • 2
  • 8
  • is there a reason why you want to place your routes in the `vue.config` file? have a looked at the [vue-router dynamic routes documentation](https://router.vuejs.org/guide/essentials/dynamic-matching.html#reacting-to-params-changes)? it gives you clues where to solve your routing. – wittgenstein Jul 18 '21 at 14:47

0 Answers0