xianniu-ui 0.9.2 → 0.9.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xianniu-ui",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -11,6 +11,9 @@
11
11
  <div class="xn-card-body" :style="styles">
12
12
  <slot></slot>
13
13
  </div>
14
+ <div class="xn-card-footer" v-if="$slots.footer">
15
+ <slot name="footer"></slot>
16
+ </div>
14
17
  </div>
15
18
  </template>
16
19
 
@@ -26,7 +29,7 @@ export default {
26
29
  type: Object,
27
30
  default: () => {
28
31
  return {
29
- padding: "18px",
32
+ padding: "18px 0",
30
33
  };
31
34
  },
32
35
  },
@@ -41,5 +44,6 @@ export default {
41
44
  };
42
45
  </script>
43
46
 
44
- <style>
47
+ <style lang="scss" scoped>
48
+
45
49
  </style>
@@ -13,4 +13,8 @@
13
13
  line-height: 25px;
14
14
  }
15
15
  }
16
+ &-footer {
17
+ padding: 18px 0;
18
+ border-top: 1px solid #f2f2f2;
19
+ }
16
20
  }
@@ -131,7 +131,7 @@ const getFileNameFromUrl = function(url){
131
131
  }
132
132
 
133
133
  /**
134
- * 根据某个key 对数组去重合并
134
+ * 根据某个key 对数组去重合并,忽略空值属性
135
135
  * @param {array} arr 需要合并的数组
136
136
  * @param {string} key 传入要合并的key ,如果是多个key,传入数组
137
137
  * @return {array} result
@@ -145,18 +145,31 @@ const arrMerge = (arr = [], key = '') => {
145
145
  }
146
146
  if (!arr.length) return []
147
147
 
148
- // 生成复合键的工具函数
149
- const getKey = (item) => keys.map(k => item[k]).join('|')
148
+ // 生成复合键的工具函数,跳过空值属性
149
+ const getKey = (item) => {
150
+ return keys
151
+ .filter(k => item[k] !== null && item[k] !== undefined && item[k] !== '') // 过滤掉空值属性
152
+ .map(k => item[k])
153
+ .join('|')
154
+ }
155
+
150
156
  const result = []
151
157
  const map = {}
152
158
 
153
159
  for (const item of arr) {
154
160
  const compositeKey = getKey(item)
155
-
161
+
162
+ // 如果所有指定属性都为空,则跳过该项
163
+ if (!compositeKey) continue
164
+
156
165
  if (!map[compositeKey]) {
157
166
  const resultItem = { children: [item] }
167
+
168
+ // 只添加非空属性到结果对象
158
169
  keys.forEach(k => {
159
- resultItem[k] = item[k]
170
+ if (item[k] !== undefined && item[k] !== null && item[k] !== '') {
171
+ resultItem[k] = item[k]
172
+ }
160
173
  })
161
174
 
162
175
  result.push(resultItem)
@@ -168,6 +181,7 @@ const arrMerge = (arr = [], key = '') => {
168
181
 
169
182
  return result
170
183
  }
184
+
171
185
  // 判空
172
186
  const isBlank = (str) => {
173
187
  if (str === null || (!str && str !== 0)) {