vue中如何使用Element-UI

123 阅读1分钟

下面介绍vue-cli项目中如何使用element-ui

1 .第一步是下载:npm i element-ui –S
2 .引入 Element

  • 完整引入
    在 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);
	
	new Vue({
	  el: '#app',
	  render: h => h(App)
	});

在各组件中可用任意模块

<template>
  <div class="ele">
 		<el-row>
 		  <el-button>默认按钮</el-button>
 		  <el-button type="primary">主要按钮</el-button>
 		  <el-button type="success">成功按钮</el-button>
 		  <el-button type="info">信息按钮</el-button>
 		  <el-button type="warning">警告按钮</el-button>
 		  <el-button type="danger">危险按钮</el-button>
 		</el-row> 
  </div>
</template>