1.3.4 • Published 5 years ago

v-ele v1.3.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

vEle

Vue封装ElementUI,快捷数据驱动开发。

安装

npm install v-ele element-ui -S

使用简介

使用之前,项目main文件需要配置如下:

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import vEle from 'v-ele'

Vue.use(ElementUI);
Vue.use(vEle);

v-ele-search

template

 <v-ele-search :options="searchOptions" @search="search" @enter="search" @change="search">
 </v-ele-search>

事件触发

事件名说明
search搜索事件
enter表单回车事件

options配置

字段可选类型默认说明
response必须Object{search: {}}引用数据
items必须Array[]字段项配置
buttons可选Array[]el-button按钮配置

items字段项配置

字段可选类型说明
title必须string字段名称
field必须string双向绑定字段
type必须stringinput|select|daterange
optionsselect非远程必须Object下拉框select列表options,例如:{key: 'id',rows:{id: 1, title: '1'}}
remoteMethodselect远程必须select远程回调事件,事件返回:{item, query},请求结果用this.$set(item'options', 'rows', list)更新下拉框select列表options
filterableselect远程必须Booleantrue
remoteselect远程必须Booleantrue
clearableselect远程必须Booleantrue
...其他element-ui参数

例子

searchOptions: {
response: {search: {}},
items: [
  {title: '昵称', field: 'nickname', type: 'input'},
  {title: '性别', field: 'gender', type: 'select', options: {rows: []}},
 ]
}

method,请求后端拿到数据给v-ele-table中的options配置tableOptions.data

search() {
    this.$http.get('/staff/select').then(res => {
        this.tableOptions.data = res.data.data.list;
    }).catch(() => {
    });
}

v-ele-table

template

<v-ele-table :options="tableOptions" @sortChange="search">
</v-ele-table>

options

字段可选类型默认说明
data必须Array[]列表数据
response必须Object{}引用数据
cols必须Array[]表头
sortChange可选StringsortChange排序事件名
border可选element-ui参数
stripe可选element-ui参数
height可选element-ui参数
maxHeight可选element-ui参数
defaultSort可选element-ui参数
showOverflowTooltip可选element-ui参数
showSummary可选element-ui参数
sumText可选element-ui参数
summaryMethod可选element-ui参数
...其他element-ui参数

cols

字段可选类型默认说明
prop必须stringelement-ui参数
label必须stringelement-ui参数
buttons可选Array[]el-button按钮组
width可选element-ui参数
type可选element-ui参数
sortable可选element-ui参数
fixed可选element-ui参数
sortBy可选element-ui参数
sortMethod可选element-ui参数
formatter可选element-ui参数
...其他element-ui参数

buttons

字段可选类型默认说明
click必须string|Functionclick区分返回事件名,比如:@delete,@edit
type可选element-ui参数
size可选element-ui参数
icon可选element-ui参数
...其他element-ui参数
1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.1

5 years ago