vue2.0-elementUI
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的更多相关文章
- Vue2.0 + Element-UI + WebAPI实践:简易个人记账系统
最近正在学习Vue2.0相关知识,正好近期饿了么桌面端组件Element-UI发布,便动手做了一款简易个人记账系统,以达到实践及巩固目的. 1.开发环境 Win10 + VS2015 + Sqlser ...
- Vue2.0+ElementUI+PageHelper实现的表格分页
Vue2.0+ElementUI+PageHelper实现的表格分页 前言 最近做了一些前端的项目,要对表格进行一些分页显示.表格分页的方法有很多,从宏观上来说分为物理分页和逻辑分页,由于逻辑分页(即 ...
- Vue2.0 + ElementUI 手写权限管理系统后台模板(一)——简述
挤一下: 一开始以为没有多少人用就没建群,但是加我的人太多了,好多问题都是重复的,所以建个群大家互相沟通交流方便点,但是建的有点晚,错过了好多人所以群里人有点少,QQ群: 157216616 小提示 ...
- vue2.0+elementUI构建单页面后台管理平台
git:https://github.com/reg21st/vue2-management-platform 访问:https://reg21st.github.io/vue2-management ...
- vue2.0+element-ui(01简单点的单页面)
前言: 在<Vue.js权威指南>刚出版的时候,自己就作为一名前端粉捧了一把场,可是真是应了那句“出来混,总是要还的“这句话了,那时候信心满满的买来书想要认真研究,最终却还是把它搁浅了.直 ...
- Vue实例:vue2.0+ElementUI框架开发pc项目
开发前准备 vue.js2.0中文,项目所使用的js框架 vue-router,vue.js配套路由 vuex,状态管理 Element,UI框架 1,根据官方指引,构建项目框架 安装vue npm ...
- vue2.0 element-ui中el-upload的before-upload方法返回false时submit()不生效解决方法
我要实现的功能是在上传文件之前校验是否表格中存在重复的数据,有的话,需要弹窗提示是否覆盖,确认之后继续上传,取消之后,就不再上传. 项目中用的element-ui是V1.4.3 <el-uplo ...
- vue2.0 element-ui中的el-select选择器无法显示选中的内容
我使用的是element-ui V2.2.3.代码如下,当我选择值得时候,el-select选择器无法显示选中的内容,但是能触发change方法,并且能输出选择的值. select.vue文件 < ...
- vue2.0+Element-ui实战案例
前言 我们将会选择使用一些 vue 周边的库vue-cli, vue-router,axios,moment,Element-ui搭建一个前端项目案例,后端数据接口,会使用json-server快速搭 ...
- vue2.0 element-ui中input的@keyup.native.enter='onQuery'回车查询刷新整个表单的解决办法
项目中用的element-ui是v1.4.3版本 实现的功能是在input中输入查询的名称,按下键盘回车键,可以查询表格中数据 问题是,我输入名称,按下回车,会整个表单刷新,搜索条件也被清空:代码如下 ...
随机推荐
- 修改maven打包名字
仅需在pom.xml添加下列配置 build> <finalName>userapi</finalName> </build>
- JAVA 程序生成jar包运行报错 Exception in thread "Thread-1" java.lang.NoClassDefFoundError: javax/xml/rpc 的解决方法
最近开发支付宝生活缴费的项目,java程序要使用.NET 的WebService服务,后来正式部署出现这错误,网上查资料是少了一个“jaxrpc.jar”文件,但是我本地调试正常,最后是删除我目前导出 ...
- django 开发之给admin 模块添加富文本编辑器
第一步下载kindeditor http://kindeditor.net/demo.php 下载下来后放到静态文件static 下面的js下面 接着在admin 模块文章类下引入这富文本编辑器: ...
- 题解 UVA12206 【Stammering Aliens】
终于A了这道题啊(坑啊) 教练说:这道题不能用map吧,复杂度不一个O(nlogn)吗 于是我就一直想不出来,然后看题解代码,一看就是map... 所以我就在想,那复杂度是不是也不是O(nlogn)呢 ...
- 面试题——ArrayList和LinkedList的区别
List概括 先回顾一下List在Collection的框架图: 从图中可以看出: List是一个接口,他继承Collection接口,代表有序的队列. AbstractList是一个抽象类, ,它继 ...
- OCP-1Z0-051-题目解析-第50题
50. SLS is a private synonym for the SH.SALES table. The user SH issues the following command: DRO ...
- less12 函数
less .x(1) { x:11 } .x(2) { y:22 } .x(@x:1) when (default()) {z:@x} //default()表示一直为真 body{ backgrou ...
- C++学习第一天--编译命令
前一个月的时间主要是在捯饬自己的ubuntu vim环境,昨天终于都搞好了,从今天开始,学习C++.至于为什么学习C++,其实很大一部分原因还是因为自己喜欢vim,又听说vim对C++的支持还不错,所 ...
- bzoj1002: [FJOI2007]轮状病毒(基尔霍夫矩阵)
1002: [FJOI2007]轮状病毒 题目:传送门 题解: 决定开始板刷的第一题... 看到这题的时候想:这不就是求有多少种最小生成树的方式吗? 不会啊!!!%题解... 什么鬼?基尔霍夫矩阵?? ...
- DSU
DSU stands for ‘decorate, sort, undecorate’ and refers to a pattern that is often useful for sorting ...