自学内容网 自学内容网

Vue组件库Element-ui

Vue组件库Element-ui

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

安装element-ui

npm install element-ui # element-ui@版本(可以指定版本号

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

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中进行修改如下:

<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>

在这里插入图片描述


原文地址:https://blog.csdn.net/qq_63432403/article/details/142731416

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!