element使用
官方网址: 点击
全局使用
1.创建项目
vue init webpack vue-ele
配置
2.安装依赖
npm install
3.安装loader模块(开发)
- npm install style-loader -D
- npm install css-loader -D
- npm install file-loader -D
4.安装ElementUI模块
npm install element-ui --S
5.在main.js中配置
- import ElementUI from ‘element-ui’
- import ‘element-ui/lib/theme-chalk/index.css’
- Vue.use(ElementUI)
6.添加build/webpack.base.conf.js 文件内容
{
test: /\\\\\\\\.css$/,
loader:"style!css"
},
{
test: /\\\\\\\\.(eot|woff|woff2|ttf)([\\\\\\\\?]?.*)$/,
loader:"file"
}
7.使用App.vue
<template>
<div id="app">
<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>
</div>
</template>
局部使用
<template>
<div id="app">
<img src="./assets/logo.png">
<router-view/>
<h1>引入element</h1>
<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-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</template> <script>
import {Button, Select} from 'element-ui' export default {
name: 'App',
data() {
return {
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
value: '' }
},
components: {
[Button.name]: Button,
[Select.name]: Select,
}
} </script> <style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
element使用的更多相关文章
- Spring配置文件标签报错:The prefix "XXX" for element "XXX:XXX" is not bound. .
例如:The prefix "context" for element "context:annotation-config" is not bound. 这种 ...
- 【解决方案】cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/javaee":run-as, "http://java.sun.com/xml/ns/javaee":security-role-r
[JAVA错误] cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One o ...
- WebComponent魔法堂:深究Custom Element 之 从过去看现在
前言 说起Custom Element那必然会想起那个相似而又以失败告终的HTML Component.HTML Component是在IE5开始引入的新技术,用于对原生元素作功能"增强& ...
- WebComponent魔法堂:深究Custom Element 之 标准构建
前言 通过<WebComponent魔法堂:深究Custom Element 之 面向痛点编程>,我们明白到其实Custom Element并不是什么新东西,我们甚至可以在IE5.5上定 ...
- WebComponent魔法堂:深究Custom Element 之 面向痛点编程
前言 最近加入到新项目组负责前端技术预研和选型,一直偏向于以Polymer为代表的WebComponent技术线,于是查阅各类资料想说服老大向这方面靠,最后得到的结果是:"资料99%是英语 ...
- 深入理解DOM节点类型第五篇——元素节点Element
× 目录 [1]特征 [2]子节点 [3]特性操作[4]attributes 前面的话 元素节点Element非常常用,是DOM文档树的主要节点:元素节点是html标签元素的DOM化结果.元素节点主要 ...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'.
spring 配置文件报错报错信息:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be ...
- MongoDB查询转对象是出错Element '_id' does not match any field or property of class
MongoDB查询转对象是出错Element '_id' does not match any field or property of class 解决方法: 1.在实体类加:[BsonIgno ...
- [LeetCode] Kth Smallest Element in a Sorted Matrix 有序矩阵中第K小的元素
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth ...
- [LeetCode] Kth Smallest Element in a BST 二叉搜索树中的第K小的元素
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Not ...
随机推荐
- ubuntu19配置静态IP并开启SSH远程登陆
前言 从ubuntu从17.10开始,已经不再在/etc/network/interfaces里配置IP,即使配置了也不会生效,而是改成netplan方式 ,配置写在/etc/netplan/文件夹 ...
- java编写杨辉三角
import java.util.Scanner; /* *计算杨辉三角: * 规律:两边都是1 * 从第三行开始,上一行的前一个元素+与其并排的元素等于下面的元素 * 例如: * 1 * 11 * ...
- 实验21:IPv6
九.IPv6 1.IPv6(RIP) 实验目的:熟悉IPv6的配置,并经过动态路由协议RIP,使三台路由器相互通讯设备需求:3640三台实验过程: xdbr_R1#sh runipv6 unicast ...
- 宅在家学不进去吗?试试这些 GitHub 上简单易学的游戏项目吧
作者:HelloGitHub-小鱼干 这是本人宅在家里的第 4 周,代码不想看,技术文章不想读,都不能愉快学习了我还怎么当一个优秀的需求消化师呢?有没有什么轻松地方法来学习技术呢?想起了小时候金山打字 ...
- golang学习笔记(一):包,变量,函数
欢迎访问我的博客和github! go 语言学习笔记第一弹,来自 gotour ,以后要常写笔记,把自己学习笔记记录下来,就算只是笔记也要多写. 好记性不如烂笔头,也要多锻炼自己的写作能力. 说实话, ...
- wordpress 如何正确升级
http://www.admin5.com/article/20141230/578710.shtml 正确的版本升级应该是,备份数据库和文件,然后禁用所有的插件后在执行升级.这样也避免不了升级过后启 ...
- 斐波那契数列(php实现)
描述 斐波那契数列指的是这样一个数列:1.1.2.3.5.8.13.21.34... 规则 : 有N个数,第i个数的值 N(i)= N(i-1) + N(i-2) 需求: 给出下标i ,求第i 的个数 ...
- Grafana & Graphite & Collectd:监控系统
简介 监控是运维工作中的一个重要组成部分,今天介绍一套新的监控工具,方便好用,扩展性强,这套工具有三个组件,Grafana & Graphite & Collectd: Grafana ...
- NR / 5G - The Best CQI algorithm
- Python 模拟登录几种常见方法
方法一:直接使用已知的cookie访问 优点: 简单,但需要先在浏览器登录 原理: 简单地说,cookie保存在发起请求的客户端中,服务器利用cookie来区分不同的客户端.因为http是一种无状态的 ...