main.js

import Vue from 'vue'
import App from './App.vue' import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css' Vue.use(ElementUI); new Vue({
el: '#app',
render: h => h(App)
})

App.vue

<template>
<div id="app">
<el-button type="primary">主要按钮</el-button>
<el-button type="danger">主要按钮</el-button>
<el-button type="info" icon="close">主要按钮</el-button>
<el-button type="success" icon="edit">主要按钮</el-button>
<el-button type="warning" icon="search">主要按钮</el-button> <span class="el-icon-delete"></span>
<span class="el-icon-loading"></span> <el-row>
<el-col :span="12">
<div class="my-grid"></div>
</el-col>
<el-col :span="12">
<div class="my-grid"></div>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="my-grid">
<Date></Date>
</div>
</el-col>
<el-col :span="8">
<div class="my-grid"></div>
</el-col>
<el-col :span="8">
<div class="my-grid"></div>
</el-col>
</el-row>
</div>
</template> <script>
import Date from './components/Date.vue'
export default {
name: 'app',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
},
components:{
Date
}
}
</script> <style scoped lang="less">
@color:red;
.height(@h){
height:@h;
}
.my-grid{
.height(50px);
border:1px solid @color; }
</style>
vue问题:
论坛
http://bbs.zhinengshe.com
------------------------------------------------
UI组件
别人提供好一堆东西 目的:
为了提高开发效率
功能 原则: 拿过来直接使用 vue-cli -> vue-loader bootstrap:
twitter 开源
简洁、大方
官网文档 基于 jquery 栅格化系统+响应式工具 (移动端、pad、pc)
按钮 都支持页面引入:<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"> 也可以通过打包工具写在main.js里面
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
最后把css打包在一个文件build.js。
--------------------------------
bower: 前端包管理器 jquery#1.11.1
自动解决依赖(下载bootstrap并找到最合适的jquery版本)
npm: node包管理器 jquery@1.11.1
-------------------------------- 饿了么团队开源一个基于vue 组件库
elementUI PC
MintUI 移动端
--------------------------------
elementUI:
如何使用 官网:http://element.eleme.io/
使用:
1. 安装 element-ui
npm i element-ui -D npm install element-ui --save-dev // i -> install
// D -> --save-dev
// S -> --save
2. 引入 main.js 入口文件
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
全部引入 3. 使用组件
Vue.use(ElementUI) css-loader 引入css
字体图标 file-loader less:
less
less-loader
-------------------------------------------------
按需加载相应组件: √
就需要 按钮
1. 下载babel-plugin-component
cnpm install babel-plugin-component -D
2. .babelrc文件里面新增一个配置
"plugins": [["component", [
{
"libraryName": "element-ui",
"styleLibraryName": "theme-default"
}
]]]
3. 想用哪个组件就用哪个
引入:
import {Button,Radio} from 'element-ui'
使用:
a). Vue.component(Button.name, Button); 个人不太喜欢
b). Vue.use(Button); √
---------------------------------------------------
发送请求:
vue-resourse 交互 axios
---------------------------------------------------
element-ui -> pc mint-ui
移动端 ui库 http://mint-ui.github.io/ 1. 下载
npm install mint-ui -S -S
--save
2. 引入
import Vue from 'vue';
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css'
Vue.use(Mint); 按需引入:
import { Cell, Checklist } from 'minu-ui';
Vue.component(Cell.name, Cell);
Vue.component(Checklist.name, Checklist); http://mint-ui.github.io/docs/#!/zh-cn2 论坛: ------------------------------------------------------- Mint-ui-demo: 看着手册走了一遍 https://github.com/itstrive/striveCode/tree/js/vue2.0-Mint-ui-demo

按需引入:

main.js

import Vue from 'vue'
import App from './App.vue'
import './element-ui.js' new Vue({
el: '#app',
render: h => h(App)
})

element-ui.js

import Vue from 'vue'

// 按钮和单选....
import {Button,Radio,DatePicker,Rate,Pagination} from 'element-ui' Vue.use(Button);
Vue.use(Radio);
Vue.use(DatePicker);
Vue.use(Rate);
Vue.use(Pagination); // tabs
import {TableColumn,Table,Switch,Badge,TabPane,Tabs} from 'element-ui'
Vue.use(Badge);
Vue.use(Table);
Vue.use(TabPane);
Vue.use(Tabs);
Vue.use(Switch);
Vue.use(TableColumn);

App.vue

<template>
<div id="app">
<el-button @click="get">普通按妞</el-button> <div>
{{myMessage}}
</div> <hr> <el-button type="primary">普通按妞</el-button> <el-radio class="radio" v-model="radio" label="1">备选项</el-radio>
<el-radio class="radio" v-model="radio" label="2">备选项</el-radio> <!-- 日历 -->
<el-date-picker
v-model="value1"
type="datetime"
placeholder="选择日期时间">
</el-date-picker> <!-- rate -->
<el-rate v-model="val"></el-rate> <!-- 分页 -->
<el-pagination
layout="prev, pager, next"
:total="1000">
</el-pagination> <!-- 选项卡 -->
<el-tabs type="card">
<el-tab-pane label="用户管理"> <el-badge :value="200" :max="99" class="item">
<el-button size="small">评论</el-button>
</el-badge> </el-tab-pane>
<el-tab-pane label="配置管理">
<el-switch
v-model="bSign"
on-text=""
off-text="">
</el-switch>
</el-tab-pane>
<el-tab-pane label="角色管理">
<el-table
:data="tableData"
style="width: 100%">
<el-table-column
prop="date"
label="日期"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="地址">
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs> <!-- button -->
<myButton @click.native="get"></myButton> </div>
</template> <script>
import myButton from './components/Button.vue'
import axios from 'axios'
export default {
components:{
myButton
},
name: 'app',
data () {
return {
myMessage:'默认数据',
msg: 'Welcome to Your Vue.js App',
radio:"1",
value1:'',
val:5,
bSign:true,
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海'
}]
}
},
mounted(){
this.get();
},
methods:{
get(){
axios.get('https://api.github.com/users/itstrive')
.then(function(res){
this.myMessage=res.data;
}.bind(this)).catch(function(err){
console.log(err);
})
}
}
}
</script> <style>
.item{
margin-top:30px;
}
</style>

Button.vue

<template>
<div>
<el-button>请求数据</el-button>
<el-button>请求数据</el-button>
<el-button>请求数据</el-button>
<el-button>请求数据</el-button>
</div>
</template>

.babelrc

{
"presets": [
["es2015", { "modules": false }]
],
"plugins": [["component", [
{
"libraryName": "element-ui",
"styleLibraryName": "theme-default"
}
]]]
}

vue2.0-elementUI的更多相关文章

  1. Vue2.0 + Element-UI + WebAPI实践:简易个人记账系统

    最近正在学习Vue2.0相关知识,正好近期饿了么桌面端组件Element-UI发布,便动手做了一款简易个人记账系统,以达到实践及巩固目的. 1.开发环境 Win10 + VS2015 + Sqlser ...

  2. Vue2.0+ElementUI+PageHelper实现的表格分页

    Vue2.0+ElementUI+PageHelper实现的表格分页 前言 最近做了一些前端的项目,要对表格进行一些分页显示.表格分页的方法有很多,从宏观上来说分为物理分页和逻辑分页,由于逻辑分页(即 ...

  3. Vue2.0 + ElementUI 手写权限管理系统后台模板(一)——简述

    挤一下: 一开始以为没有多少人用就没建群,但是加我的人太多了,好多问题都是重复的,所以建个群大家互相沟通交流方便点,但是建的有点晚,错过了好多人所以群里人有点少,QQ群: 157216616 小提示 ...

  4. vue2.0+elementUI构建单页面后台管理平台

    git:https://github.com/reg21st/vue2-management-platform 访问:https://reg21st.github.io/vue2-management ...

  5. vue2.0+element-ui(01简单点的单页面)

    前言: 在<Vue.js权威指南>刚出版的时候,自己就作为一名前端粉捧了一把场,可是真是应了那句“出来混,总是要还的“这句话了,那时候信心满满的买来书想要认真研究,最终却还是把它搁浅了.直 ...

  6. Vue实例:vue2.0+ElementUI框架开发pc项目

    开发前准备 vue.js2.0中文,项目所使用的js框架 vue-router,vue.js配套路由 vuex,状态管理 Element,UI框架 1,根据官方指引,构建项目框架 安装vue npm ...

  7. vue2.0 element-ui中el-upload的before-upload方法返回false时submit()不生效解决方法

    我要实现的功能是在上传文件之前校验是否表格中存在重复的数据,有的话,需要弹窗提示是否覆盖,确认之后继续上传,取消之后,就不再上传. 项目中用的element-ui是V1.4.3 <el-uplo ...

  8. vue2.0 element-ui中的el-select选择器无法显示选中的内容

    我使用的是element-ui V2.2.3.代码如下,当我选择值得时候,el-select选择器无法显示选中的内容,但是能触发change方法,并且能输出选择的值. select.vue文件 < ...

  9. vue2.0+Element-ui实战案例

    前言 我们将会选择使用一些 vue 周边的库vue-cli, vue-router,axios,moment,Element-ui搭建一个前端项目案例,后端数据接口,会使用json-server快速搭 ...

  10. vue2.0 element-ui中input的@keyup.native.enter='onQuery'回车查询刷新整个表单的解决办法

    项目中用的element-ui是v1.4.3版本 实现的功能是在input中输入查询的名称,按下键盘回车键,可以查询表格中数据 问题是,我输入名称,按下回车,会整个表单刷新,搜索条件也被清空:代码如下 ...

随机推荐

  1. (2016北京集训十)【xsy1529】小Q与进位制 - 分治FFT

    题意很简单,就是求这个数... 其实场上我想出了分治fft的正解...然而不会打...然后打了个暴力fft挂了... 没啥好讲的,这题很恶心,卡常卡精度还爆int,要各种优化,有些dalao写的很复杂 ...

  2. WPF内嵌WCF服务对外提供接口

    要测试本帖子代码请记得管理员权限运行vs. 我写这个帖子的初衷是在我做surface小车的时候有类似的需求,感觉这个功能还挺有意思的,所以就分享给大家,网上有很多关于wcf的文章 我就不一一列举了.公 ...

  3. You Probably Don’t Need a Message Queue

    原文地址 I’m a minimalist, and I don’t like to complicate software too early and unnecessarily. And addi ...

  4. Zabbix分布式配置

    Zabbix是一个分布式监控系统,它可以以一个中心点.多个分节点的模式运行,使用Proxy能大大的降低Zabbix Server的压力,Zabbix Proxy可以运行在独立的服务器上,安装Zabbi ...

  5. 【Henu ACM Round#24 D】Iterated Linear Function

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 把B提取出来就是一个等比数列了. 求和一下会发现是这种形式. \(B*\frac{(A^n-1)}{A-1}+A^n*x\) 则求一 ...

  6. JAVA学习第四十六课 — 其它对象API(二)Date类 &amp; Calendar类(重点掌握)

    Date类(重点) 开发时,会时常遇见时间显示的情况,所以必须熟练Date的应用 <span style="font-family:KaiTi_GB2312;font-size:18p ...

  7. hdu_3308 区间合并

    一两个月没写代码的确是手生的厉害,debug的好艰辛,,不过看到accept时的那种满足感真的就是爽 #include<iostream> #include<cstdio> # ...

  8. bzoj1430: 小猴打架(prufer序列)

    1430: 小猴打架 题目:传送门 简要题意: n只互不相识的猴子打架,打架之后就两两之间连边(表示已经相互认识),只有不认识(朋友的朋友都是朋友)的两只猴子才会打架.最后所有的猴子都会连成一棵树,也 ...

  9. 智课雅思词汇---八、ject是什么意思

    智课雅思词汇---八.ject是什么意思 一.总结 一句话总结:词根:ject, jac(jet) = to throw(投掷, 扔) 1.geo是什么意思? 词根:-ge-, -geo- [词根含义 ...

  10. poj--2083--Fractal(dfs)

    Fractal Time Limit: 1000MS   Memory Limit: 30000KB   64bit IO Format: %I64d & %I64u Submit Statu ...