vsyswin-ui 0.2.43 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/vsyswin-ui.common.js +36963 -36180
- package/lib/vsyswin-ui.common.js.map +1 -1
- package/lib/vsyswin-ui.umd.js +36963 -36180
- package/lib/vsyswin-ui.umd.js.map +1 -1
- package/lib/vsyswin-ui.umd.min.js +181 -181
- package/lib/vsyswin-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/packages/index.js +5 -3
- package/packages/paging/index.js +10 -0
- package/packages/paging/src/paging.vue +86 -0
package/package.json
CHANGED
package/packages/index.js
CHANGED
|
@@ -7,19 +7,20 @@ import selectProject from './select-project' // 项目选择组件
|
|
|
7
7
|
import selectTree from './select-tree' // 表单树选择器
|
|
8
8
|
import SearchBar from './search-bar' // 搜索工具栏
|
|
9
9
|
import simpleSearchBar from './simple-search-bar' // 简单搜索栏组件
|
|
10
|
+
import paging from './paging'
|
|
10
11
|
import newSearchBar from './newSearchBar' // 高级筛选
|
|
11
12
|
import table from './table' // 表格组件
|
|
12
13
|
import dragSet from './drag-set'
|
|
13
14
|
|
|
14
15
|
// 存储组件列表
|
|
15
|
-
const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, newSearchBar, table, dragSet]
|
|
16
|
+
const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, paging, newSearchBar, table, dragSet]
|
|
16
17
|
|
|
17
18
|
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
|
|
18
|
-
const install = function(Vue) {
|
|
19
|
+
const install = function (Vue) {
|
|
19
20
|
// 判断是否可以安装
|
|
20
21
|
if (install.installed) return
|
|
21
22
|
// 遍历注册全局组件
|
|
22
|
-
components.map(component => Vue.component(component.name, component))
|
|
23
|
+
components.map((component) => Vue.component(component.name, component))
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
// 判断是否是直接引入文件
|
|
@@ -37,6 +38,7 @@ export default {
|
|
|
37
38
|
selectTree,
|
|
38
39
|
SearchBar,
|
|
39
40
|
simpleSearchBar,
|
|
41
|
+
paging,
|
|
40
42
|
newSearchBar,
|
|
41
43
|
table,
|
|
42
44
|
dragSet
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!-- 分页组件 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div :style="alignStyle">
|
|
4
|
+
<el-pagination
|
|
5
|
+
class="cus-pagination"
|
|
6
|
+
background
|
|
7
|
+
prev-text="上一页"
|
|
8
|
+
next-text="下一页"
|
|
9
|
+
size="small"
|
|
10
|
+
@size-change="handleSizeChange"
|
|
11
|
+
@current-change="handlePageChange"
|
|
12
|
+
:current-page="pagination.currentPage"
|
|
13
|
+
:page-sizes="pageSizes"
|
|
14
|
+
:page-size="pagination.pageSize"
|
|
15
|
+
:layout="layout"
|
|
16
|
+
:total="pagination.totals"
|
|
17
|
+
>
|
|
18
|
+
<slot>
|
|
19
|
+
<span class="el-pagination__total">总共 {{ pagination.totals }} 条,{{ Math.ceil(pagination.totals / pagination.pageSize) }} 页</span>
|
|
20
|
+
</slot>
|
|
21
|
+
</el-pagination>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
/*
|
|
27
|
+
pagination: {
|
|
28
|
+
currentPage: 1,
|
|
29
|
+
pageSize: 20,
|
|
30
|
+
totals: 0
|
|
31
|
+
}
|
|
32
|
+
*/
|
|
33
|
+
export default {
|
|
34
|
+
name: 'SyPaging',
|
|
35
|
+
props: {
|
|
36
|
+
align: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'right',
|
|
39
|
+
validator: function (value) {
|
|
40
|
+
return ['left', 'center', 'right'].indexOf(value) !== -1
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
layout: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'slot, prev, pager, next, sizes, jumper'
|
|
46
|
+
},
|
|
47
|
+
pagination: {
|
|
48
|
+
type: Object,
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
pageSizes: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default() {
|
|
54
|
+
return [10, 20, 50, 100, 200]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
computed: {
|
|
59
|
+
alignStyle() {
|
|
60
|
+
return {
|
|
61
|
+
'text-align': this.align
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
// 每页数量发生改变
|
|
67
|
+
handleSizeChange(val) {
|
|
68
|
+
const { currentPage, totals } = this.pagination
|
|
69
|
+
const maxNum = Math.ceil(totals / val)
|
|
70
|
+
this.pagination.currentPage = maxNum < currentPage ? maxNum : currentPage
|
|
71
|
+
this.pagination.pageSize = val
|
|
72
|
+
this.handleChange('pageSize')
|
|
73
|
+
},
|
|
74
|
+
// 页码发生改变
|
|
75
|
+
handlePageChange(val) {
|
|
76
|
+
this.pagination.currentPage = val
|
|
77
|
+
this.handleChange('currentPage')
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
handleChange(type) {
|
|
81
|
+
const { currentPage, pageSize } = this.pagination
|
|
82
|
+
this.$emit('change', { currentPage, pageSize }, type)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</script>
|