Vs Code 联动API操作
一、Element UI使用
1.使用npm i element-ui -S 进行下载 Element UI组件
2.在main.js中添加
import Vue from 'vue'; import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; import App from './App.vue';
Vue.use(ElementUI);
(此代码可在 https://element.eleme.cn/#/zh-CN/component/installation 网站—快速上手查询)
3.在element UI官网中截取自己所需要的代码 粘贴到项目中
二、Axios操作
1. 通过npm install axios -S 命令安装 axios 的相关依赖
2. 打开main.js 通过 import axios from 'axios' 引入
3. 通过 Vue.prototype.$axios = axios; 挂载到 VUE的原型链上 (全局使用)
4. 使用方法:任何页面使用是 this.$axios.get('链接') 或 this.$axios.post('链接')
三、Vs Code小点
1.项目中存在的组件(依赖项或下载项)可在 package.json项目查看
2.在配置路由页面router—index.js中 不使用path:“/” 为从index根目录中访问,使用“/”为访问子集不访问index
3. 视图页面的<router-view>.</router-view>可与路由页面children联动使用
4.从Element UI官网中下载的代码在使用时候应检查是否有@方法未定义(未使用) 如果有应该及时删除 否则会报错

浙公网安备 33010602011771号