# webpack-vue **Repository Path**: rong_hua/webpack-vue ## Basic Information - **Project Name**: webpack-vue - **Description**: No description available - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-07 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # webpack + vue + axios ## api - 网址:http://www.liulongbin.top:3005/ - GET - 新闻列表: api/getnewslist - 新闻详情列表:api/getnew/:id - 评论列表:api/getcomments/:id%20?pageindex=1 - 图片全部分类: api/getimgcategory - 图片列表:api/getimages/:cateid - 图片详情:api/getimageinfo/:imgid - 图片详情缩略图(商品缩略图同一接口):api/ getthumimages/:imgid - 商店列表:api/getgoods?pageindex=numnber(页码) - 商品详情数据:api/goods/getinfo/:id - 商品图文介绍: api/goods/getdesc/:id - 获取购物车页面数据:api/goods/getshopcarlist/:ids - POST - 发送评论:api/postcomment/:id ```js //数据 { connent: "评论内容" } ``` ## axios 1. 安装axios和vue-axios ```js npm install --save axios; ``` 2. 导入到js ```js // index.js import Axios from "axios"; ``` 3. 修改vue原型 ```js // index.js Vue.prototype.$http = axios; ``` 4. 在需要请求的js上直接引用 ```js this.$http.get(api).then((response) => { console.log(response.data) }) ``` ## vue-router 1. 安装包 ```js npm install vue-router -s ``` 2. 导入包并注册到Vue ```js import VueRouter from "vue-router"; Vue.use(VueRouter); ``` 3. 创建路由 ```js const router = new VueRouter({ routes: [ { test: "url", component: "组件" } ] }) ``` 4. 在vue实例挂载路由 ```js const vm = new Vue({ el: "", data: { }, router }) ``` 5. html填坑 ```html ``` ## 取消webpack的严格模式 babel-plugin-transform-remove-strict-mode