Vue83 引入elementUI

笔记

  • 安装插件
  • 安装按需引入插件

代码

### App.vue

html 复制代码
<template>
  <div>
		<button>原生的按钮</button>
		<input type="text">
		<atguigu-row>
			<atguigu-button>默认按钮</atguigu-button>
			<atguigu-button type="primary">主要按钮</atguigu-button>
			<atguigu-button type="success">成功按钮</atguigu-button>
			<atguigu-button type="info">信息按钮</atguigu-button>
			<atguigu-button type="warning">警告按钮</atguigu-button>
			<atguigu-button type="danger">危险按钮</atguigu-button>
		</atguigu-row>
		<atguigu-date-picker
      type="date"
      placeholder="选择日期">
    </atguigu-date-picker>
		<atguigu-row>
			<atguigu-button icon="el-icon-search" circle></atguigu-button>
			<atguigu-button type="primary" icon="el-icon-s-check" circle></atguigu-button>
			<atguigu-button type="success" icon="el-icon-check" circle></atguigu-button>
			<atguigu-button type="info" icon="el-icon-message" circle></atguigu-button>
			<atguigu-button type="warning" icon="el-icon-star-off" circle></atguigu-button>
			<atguigu-button type="danger" icon="el-icon-delete" circle></atguigu-button>
		</atguigu-row>
  </div>
</template>

<script>
	export default {
		name:'App',
	}
</script>

main.js

javascript 复制代码
//引入Vue
import Vue from 'vue'
//引入App
import App from './App.vue'

//完整引入
//引入ElementUI组件库
// import ElementUI from 'element-ui';
//引入ElementUI全部样式
// import 'element-ui/lib/theme-chalk/index.css';

//按需引入
import { Button,Row,DatePicker } from 'element-ui';

//关闭Vue的生产提示
Vue.config.productionTip = false

//应用ElementUI
// Vue.use(ElementUI);
Vue.component('atguigu-button', Button);
Vue.component('atguigu-row', Row);
Vue.component('atguigu-date-picker', DatePicker);

//创建vm
new Vue({
	el:'#app',
	render: h => h(App),
})

babel.config.js

javascript 复制代码
module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset',
		["@babel/preset-env", { "modules": false }],
  ],
	plugins:[
    [
      "component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ]
}

vue脚手架升级,已经不存在 .babelrc 文件,改为babel.config.js文件

运行

相关推荐
Mike_jia18 分钟前
uuWAF:开源Web应用防火墙新标杆——从工业级防护到智能防御实战解析
前端
掘金安东尼28 分钟前
Chrome 17 岁了——我们的浏览器简史
前端·javascript·github
袁煦丞28 分钟前
群晖NAS FTP远程文件仓库全球访问:cpolar内网穿透实验室第524个成功挑战
前端·程序员·远程工作
前端小巷子32 分钟前
JS 打造动态表格
前端·javascript·面试
excel44 分钟前
从卷积到全连接:用示例理解 CNN 的分层
前端
UNbuff_01 小时前
HTML 各种事件的使用说明书
前端·html
Mr. Cao code1 小时前
探索OpenResty:高性能Web开发利器
linux·运维·服务器·前端·nginx·ubuntu·openresty
li35749 小时前
将已有 Vue 项目通过 Electron 打包为桌面客户端的完整步骤
前端·vue.js·electron
Icoolkj9 小时前
VuePress 与 VitePress 深度对比:特性、差异与选型指南
前端·javascript·vue.js
excel9 小时前
CNN 分层详解:卷积、池化到全连接的作用与原理
前端