node.js - After the vue project is built, there is no problem opening the listening port, but it hangs after refreshing the page.
漂亮男人
漂亮男人 2017-05-16 13:30:23
0
1
641

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 #?

漂亮男人
漂亮男人

reply all(1)
漂亮男人

vue-router document-history backend configuration

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template