我是靠谱客的博主 结实航空,这篇文章主要介绍element-ul基本使用,现在分享给大家,希望可以做个参考。

1.移动端常用UI组件库

  1. Vant
  2. Cube UI
  3. Mint UI

2. PC端常用UI组件库

  1. Element UI
  2. IView UI

3.基本使用

  1. 安装 element-ui:

    npm i element-ui -S

  2. src/main.js:

    import Vue from 'vue'
    import App from './App.vue'
    //引入ElementUI组件库
    import ElementUI from 'element-ui';
    //引入ElementUI全部样式
    import 'element-ui/lib/theme-chalk/index.css';
    Vue.config.productionTip = false
    //使用ElementUI
    Vue.use(ElementUI)
    new Vue({
    el:"#app",
    render: h => h(App),
    })
    

src/App.vue:

<template>
<div>
<br>
<el-row>
<el-button icon="el-icon-search" circle></el-button>
<el-button type="primary" icon="el-icon-edit" circle></el-button>
<el-button type="success" icon="el-icon-check" circle></el-button>
<el-button type="info" icon="el-icon-message" circle></el-button>
<el-button type="warning" icon="el-icon-star-off" circle></el-button>
<el-button type="danger" icon="el-icon-delete" circle></el-button>
</el-row>
</div>
</template>
<script>
export default {
name:'App',
}
</script>

 4.element-ui按需引入

  1. 安装 babel-plugin-component:

    npm install babel-plugin-component -D

  2. 修改 babel-config-js
    module.exports = {
    presets: [
    '@vue/cli-plugin-babel/preset',
    ["@babel/preset-env", { "modules": false }]
    ],
    plugins: [
    [
    "component",
    {
    "libraryName": "element-ui",
    "styleLibraryName": "theme-chalk"
    }
    ]
    ]
    }
    

src/main.js:

import Vue from 'vue'
import App from './App.vue'
//按需引入
import { Button,Row } from 'element-ui'
Vue.config.productionTip = false
Vue.component(Button.name, Button);
Vue.component(Row.name, Row);
/* 或写为
* Vue.use(Button)
* Vue.use(Row)
*/
new Vue({
el:"#app",
render: h => h(App),
})

最后

以上就是结实航空最近收集整理的关于element-ul基本使用的全部内容,更多相关element-ul基本使用内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(128)

评论列表共有 0 条评论

立即
投稿
返回
顶部