Vue组件库Element-ui

Vue组件库Element-ui

Element是一套为开发者、设计师和产品经理准备的基于Vue2.0的桌面端组件库。Element - 网站快速成型工具

安装element-ui

shell 复制代码
npm install element-ui # element-ui@版本(可以指定版本号

引入ElementUI组件库,在main.js中添加内容得到:

javascript 复制代码
import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 引入element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.config.productionTip = false

// 使用element-ui
Vue.use(ElementUI);
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

在App.vue中进行修改如下:

vue 复制代码
<template>
  <div>
    <ElementView></ElementView>
  </div>
</template>

<script>
import ElementView from './views/ElementView.vue';

  export default {
    components: {
      ElementView
    },
    data() {
      return {
        msg: 'Welcome to Your Vue.js App'
      }
    },
    mounted() {
      console.log('App.vue mounted');
  }
}
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
相关推荐
cidy_9834 分钟前
codebase-memory-mcp 安装教程
前端
mt_z38 分钟前
Webpack 与 Vite 完全指南
前端
灏仟亿前端技术团队42 分钟前
B 端多弹窗越来越难维护?试试把弹窗交互 Promise 化
前端
奇奇怪怪的42 分钟前
向量数据库选型与生产级实战
前端
徐小夕2 小时前
jitword 协同文档3.2发布:打造浏览器中最强word编辑器
前端·架构·github
纯爱掌门人3 小时前
干了这么多年前端,聊聊 2026 年我们到底还值不值钱
前端·程序员
houhou3 小时前
Monaco Editor 集成指南:从配置到优化
前端
hunterandroid4 小时前
[Android 从零到一] Custom View 自定义绘制:从 onDraw 到完整交互
前端
李明卫杭州4 小时前
Vue3 v-memo 指令详解:让你的列表渲染性能翻倍 🚀
前端
梨子同志4 小时前
Monorepo
前端