element.js上手实践——以todolist为例子

下载

https://github.com/ElementUI/element-starter

安装

npm run dev

代理的坑

  '/api/': {
        target: 'http://127.0.0.1:3000',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }

后端可按正常书写,vue端请求时,post请求一律带上api前缀。比如分类保存接口,后端路径是localhost:3000/category/save,而vue-resource请求的就应是$http.post('api/category/save')

对打包的影响是,访问不了,于是还是'^/api': '/api/'

组织路由

Layout布局

母版

vue-resource引入

var $http = require('vue-resource').Http;
$http.post('url', param)

静态

你可能感兴趣的:(element.js上手实践——以todolist为例子)