2017-04-26 78 views
0

VUE路由器的URL显示为的 '#' 在我的网址是不正确的,当我用快递

本地主机:3000/指数# /仪表板

但不

本地主机:3000/指数/# /仪表板

这是一种有线。

这是我的快递代码。

app.get('/index', function (req, res) { 
    const html = fs.readFileSync('index.html', 'utf-8'); 
    res.send(html); 
}); 

而我的vue路由器代码。

{ 
    name: 'dashboard', 
    path: '/dashboard', 
    component: require('../views/dashboard.vue') 
} 

回答

0

尝试在VueRouter

const router = new VueRouter({ 
    mode: 'history', 
    routes: [...] 
}) 

对于还与快递的详细信息设置mode: 'history',请参阅Vue Router HTML5 history mdoe

+0

如果我这样做,将URL'本地主机:3000/dashboard' ,但我想保留路径'/ index /' –

相关问题