1、初始化创建vue项目:
打开终端并输入命令
vue init webpack vueui
-------------请参阅
? 项目名称my de movue #=项目名称
? projectdescriptionavue.js project #=项目说明
? Author malun #=作者
? vue build标准#=是否支持单个文件组件
? Use ESLint to lint your code? 是#=是否支持eslint代码检查
? pick an eslint预设标准#=验证的标准是什么?
? Setup unit tests with Karma Mocha? 是#=是否使用单元测试
? Setup e2e tests with Nightwatch? 是否使用ys#=e2e测试
注:使用eslint to lint your代码可以选择否。 如果不选择NO,将进行验证,并显示代码警告。
2、切换到项目,安装element-ui:
建议使用npm方式安装。 改进了与web包工具的协作。
npm i element-ui -S
可以在package.json上找到element-ui的版本信息
3、项目中使用element-ui :
在main.js上部署和使用:
//thevuebuildversiontoloadwiththe `导入` command
//(runtime-onlyorStandalone ) hasbeensetinwebpack.base.confwithanalias。
import Vue from 'vue '
import App from './App '
import router from './router '
/*引入以下三行*
导入元素ui from ' element-ui ';
导入' element-ui/lib/theme-chalk/index.CSS ';
vue.use (元素ui );
Vue.config.productionTip=false
/* eslint-disable no-new */
newvue({
El : ' # APP ',
劳特、
组件: { app },
template: ' '
() )
4、看效果:
修改组件- hello world.vue :
Click Me
. El-fade-in-linear.El-fade-inexportdefault {
data: (() )。
show :真
() )
}
. transition-box {
玛格琳- bottom : 10px;
width: 200px;
height: 100px;
border-radius: 4px;
背景色: # 409 Eff;
文本对齐3360中心;
color: #fff;
padding: 40px 20px;
盒尺寸: border-box;
玛姬- right : 20px;
}
开始项目
npm run dev
目前已成功部署了element-ui框架