xianniu-ui 0.3.19 → 0.3.21
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/xianniu-ui.common.js +85 -27
- package/lib/xianniu-ui.umd.js +85 -27
- package/lib/xianniu-ui.umd.min.js +3 -3
- package/package.json +1 -1
- package/packages/table/main.vue +1 -1
- package/src/utils/utils.js +35 -2
package/package.json
CHANGED
package/packages/table/main.vue
CHANGED
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
:pageNum.sync="page.pageNum"
|
|
141
141
|
:pageSize.sync="page.pageSize"
|
|
142
142
|
@pagination="getList"
|
|
143
|
+
v-bind="$attrs"
|
|
143
144
|
layout="total, prev, pager, next, jumper"
|
|
144
145
|
></xn-page>
|
|
145
146
|
</template>
|
|
@@ -198,7 +199,6 @@ export default {
|
|
|
198
199
|
},
|
|
199
200
|
computed: {},
|
|
200
201
|
created() {
|
|
201
|
-
console.log(this.$slots);
|
|
202
202
|
!this.$slots.default &&
|
|
203
203
|
this.columns.length &&
|
|
204
204
|
this.columns.forEach((item) => {
|
package/src/utils/utils.js
CHANGED
|
@@ -70,7 +70,7 @@ const download = (params = { name: '', url: '' }) => {
|
|
|
70
70
|
x.open('GET', url, true)
|
|
71
71
|
// x.responseType = 'blob'
|
|
72
72
|
// x.responseType = 'blob'
|
|
73
|
-
x.onprogress = function(){
|
|
73
|
+
x.onprogress = function () {
|
|
74
74
|
}
|
|
75
75
|
x.onload = function () {
|
|
76
76
|
var _url = ''
|
|
@@ -87,10 +87,43 @@ const download = (params = { name: '', url: '' }) => {
|
|
|
87
87
|
}
|
|
88
88
|
x.send()
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* 根据某个key 对数组去重合并
|
|
92
|
+
* @param {array} arr 需要合并的数组
|
|
93
|
+
* @param {string} key 传入要合并的key
|
|
94
|
+
* @return {array} result
|
|
95
|
+
*/
|
|
96
|
+
const arrMerge = (arr = [], key = '') => {
|
|
97
|
+
if (!key) {
|
|
98
|
+
throw new Error('error arguments: key is required')
|
|
99
|
+
}
|
|
100
|
+
if(!arr.length) return
|
|
101
|
+
var map = {}; var result = []
|
|
90
102
|
|
|
103
|
+
for (var i = 0; i < arr.length; i++) {
|
|
104
|
+
var ai = arr[i]
|
|
105
|
+
if (!map[ai[key]]) {
|
|
106
|
+
result.push({
|
|
107
|
+
[key]: ai[key],
|
|
108
|
+
children: [ai]
|
|
109
|
+
})
|
|
110
|
+
map[ai[key]] = ai
|
|
111
|
+
} else {
|
|
112
|
+
for (var j = 0; j < result.length; j++) {
|
|
113
|
+
var dj = result[j]
|
|
114
|
+
if (dj[key] === ai[key]) {
|
|
115
|
+
dj.children.push(ai)
|
|
116
|
+
break
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return result
|
|
122
|
+
}
|
|
91
123
|
export default {
|
|
92
124
|
isEmpty,
|
|
93
125
|
isImg,
|
|
94
126
|
deepClone,
|
|
95
|
-
download
|
|
127
|
+
download,
|
|
128
|
+
arrMerge
|
|
96
129
|
}
|