当前位置: 首页 > news >正文

1.3 vue ui框架-element-ui框架

1 前言

ElementUI是一套基于VUE2.0的桌面端组件库,ElementUI提供了丰富的组件帮助开发人员快速构建功能强大、风格统一的页面。

ElementUI官网 https://element.eleme.io

2 安装

运行命令

cnpm i element-ui -S

-S表示只在该项目下安装,不是全局安装

注意:要跳到项目所在目录运行

会在node_modules文件夹下生成element-ui子目录

3 应用

接1.1 创建第一个vue项目-CSDN博客生成的项目。

3.1 在src/main.js中引入element组件,修改后代码如下:

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'/*引入element组件*/
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);Vue.config.productionTip = false/* eslint-disable no-new */
new Vue({el: '#app',router,components: { App },template: '<App/>'
})

3.2 修改src/components/HelloWorld.vue代码如下

<template><div class="hello"><h1>{{ msg }}</h1><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><script>
export default {name: "HelloWorld",data() {return {msg: "使用element-ui测试",};},
};
</script><!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {font-weight: normal;
}
ul {list-style-type: none;padding: 0;
}
li {display: inline-block;margin: 0 10px;
}
a {color: #42b983;
}
</style>

3.3 运行效果

在cmd运行命令npm run dev 然后访问http://localhost:8080,效果如下:

http://www.lryc.cn/news/310844.html

相关文章:

  • 关于MediaEval数据集的Dataset构建(Text部分-使用PLM BERT)
  • QML学习之Text
  • 轮转数组(元素位置对调、数据的左旋、右旋)
  • 喜迎乔迁,开启新章 ▏易我科技新办公区乔迁庆典隆重举行
  • 多个地区地图可视化
  • 学习使用paddle来构造hrnet网络模型
  • Redis 多线程操作同一个Key如何保证一致性?
  • 单链表合并
  • 【如何像网吧一样弄个游戏菜单在家里】
  • CSS~~
  • Docker技术概论(1):Docker与虚拟化技术比较
  • alibabacloud学习笔记07(小滴课堂)
  • Ansible-Playbook
  • UE5常见问题处理笔记
  • docker中hyperf项目配置虚拟域名
  • PID闭环控制算法的学习与简单使用
  • 【无刷电机学习】光耦HCNR200基本原理及应用(资料摘抄)
  • 【LeetCode】1768_交替合并字符串_C
  • C#解析JSON
  • AI图像识别算法助力安全生产*提升风险监测效率---豌豆云
  • CSS技巧:实现两个div在同一行显示的方法
  • 【Unity】Node.js安装与配置环境
  • Vue3:使用 Composition API 不需要 Pinia
  • ExoPlayer 播放视频黑屏的解决方法
  • C语言初阶—数组
  • 飞桨(PaddlePaddle)数据预处理教程
  • MYSQL C++链接接口编程
  • 并发编程中常见的设计模式,c++多线程如何设计
  • 解决android studio build Output中文乱码
  • [云原生] K8s之pod进阶