search

Home  >  Q&A  >  body text

node.js - After the vue project is built, there is no problem opening the listening port, but it hangs after refreshing the page.

No questions asked when running in the development environment. Then after npm run build, there is no problem in opening the listening port,

But after refreshing the page, it hangs. After refreshing, it is as shown below


Then I changed the code in main.js. After the build, refreshing the page will not hang, but I don’t know why

before fixing

let router = new VueRouter({
mode: 'history',
routes: [
{
path: '/',
component: goods
},
{
path: '/goods',
component: goods
},
{
path: '/ratings',
component: ratings
},
{
path: '/seller',
component: seller
}

],
linkActiveClass: 'active'

})

After modification

const routes = [{
  path: '/',
  redirect: '/goods'
}, {
  path: '/goods',
  component: goods
}, {
  path: '/ratings',
  component: ratings
}, {
  path: '/seller',
  component: seller
}];

const router = new VueRouter({
  linkActiveClass: 'active',
  routes
});

Is there a reason why the modified url has one more #?

漂亮男人漂亮男人2753 days ago621

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 13:32:23

    vue-router document-history backend configuration

    reply
    0
  • Cancelreply