安装axios
项目不能处于运行状态,按ctrl + c键,结束运行。按两次ctrl + c。
在CMD中输入(一定要在当前项目文件夹中)
表示使用npm(nodejs包管理器)安装(install)axios。并且要保存(--save)。
npm install --save axios
重新启动npm run serve
安装配置element-ui
官网:https://element.eleme.cn/#/zh-CN
第一步,
在你的项目中,终止项目运行(ctrl+c),在CMD(一定要确保CMD的路径是你的项目文件夹)中运行:注意,-S就是--save的简写。i是install的简写。
npm i element-ui -S
第二步,
来到public/index.html文件,<head>里引入一个样式表:
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-
chalk/index.css">
第三步,来到src/main.js,修改为:
import Vue from 'vue';
import App from './App.vue';
import elementUI from 'element-ui'; // 新增的
Vue.config.productionTip = false;
// 使用饿了么UI
Vue.use(elementUI); // 新增的
new Vue({
render: h => h(App),
}).$mount('#app')
第四步,可以愉快的使用饿了么UI的组件了