VUE2.0
webpack.dev.conf.js配置
const express = require('express');
const app = express();
var appData = require('../data.json');
var seller = appData.seller;
var goods = appData.goods;
var ratings = appData.ratings;
var apiRoutes = express.Router();
apiRoutes.get('/seller',function (req,res) {
res.json({
errno:0,
data: seller
});
});
apiRoutes.get('/goods',function (req,res) {
res.json({
errno:0,
data: goods
});
});
apiRoutes.get('/ratings',function (req,res) {
res.json({
errno:0,
data: ratings
});
});
app.use('/api',apiRoutes);
main.js 配置
Vue.config.productionTip = false;
Vue.use(VueRouter);
Vue.use(VueResource);
const routes = [
{path: '/', redirect: '/goods'},
{path: '/goods', component: goods},
{path: '/seller', component: sellers},
{path: '/rating', component: ratings}
];
var router = new VueRouter({routes, linkActiveClass: 'active'});
new Vue({
router,
render: h => h(App)
}).$mount('#app');
重启服务之后,还是报错404,请老师同学帮忙看一下,谢谢
掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp
了解课程