xianniu-ui 0.8.18 → 0.8.20

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.8.18",
3
+ "version": "0.8.20",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="xn-ellipsis" ref="root">
2
+ <div class="xn-ellipsis" ref="root" @mouseover="onMouseUp" @mouseleave="onMouseLeave">
3
3
  {{ expanded ? content : text }}
4
- <span class="xn-ellipsis__action" v-if="hasAction" @click="onClickAction">{{
4
+ <span class="xn-ellipsis__action" v-if="hasAction" @click="onClickAction">{{
5
5
  expanded ? collapseText : expandText
6
6
  }}</span>
7
7
  </div>
@@ -27,6 +27,10 @@ export default {
27
27
  type: String,
28
28
  default: "收起",
29
29
  },
30
+ trigger:{
31
+ type:String,
32
+ default:"click"
33
+ }
30
34
  },
31
35
  data() {
32
36
  return {
@@ -64,6 +68,7 @@ export default {
64
68
  const { root } = this.$refs;
65
69
  const cloneContainer = () => {
66
70
  if (!root) return;
71
+ console.log("🚀 ~ file: main.vue:71 ~ cloneContainer ~ root:", root)
67
72
  const originStyle = window.getComputedStyle(root);
68
73
  const container = document.createElement("div");
69
74
  const styleNames = Array.prototype.slice.apply(originStyle);
@@ -80,6 +85,7 @@ export default {
80
85
 
81
86
  container.innerText = this.content;
82
87
  document.body.appendChild(container);
88
+ console.log(container);
83
89
  return container;
84
90
  };
85
91
  const calcEllipsisText = (container, maxHeight) => {
@@ -123,9 +129,20 @@ export default {
123
129
  document.body.removeChild(container);
124
130
  },
125
131
  onClickAction(event) {
132
+ if(this.trigger !== 'click') return
126
133
  this.expanded = !this.expanded;
127
134
  this.$emit("clickAction", event);
128
135
  },
136
+ onMouseUp(event){
137
+ if(this.trigger!=='hover') return
138
+ this.expanded =!this.expanded;
139
+ this.$emit("hover", event);
140
+ },
141
+ onMouseLeave(event){
142
+ if(this.trigger!=='hover') return
143
+ this.expanded = false;
144
+ this.$emit("hover", event);
145
+ }
129
146
  },
130
147
  mounted() {
131
148
  this.calcEllipsised();
@@ -24,9 +24,22 @@
24
24
  v-model="item.modelVal"
25
25
  v-bind="item.options ? { ...item.options } : {}"
26
26
  @on-city="handleChangeCity"
27
-
28
27
  />
29
28
  </el-form-item>
29
+ <el-form-item
30
+ v-if="item.type === 'cascader'"
31
+ :key="idx"
32
+ :label="item.label"
33
+ :prop="item.prop"
34
+ class="xn-search--row_col"
35
+ >
36
+ <el-cascader
37
+ style="width:100%"
38
+ :options="item.data"
39
+ v-bind="item.options ? { ...item.options } : {}"
40
+ @change="onChangeCascader($event,item)"
41
+ ></el-cascader>
42
+ </el-form-item>
30
43
  <el-form-item
31
44
  v-if="item.type === 'input'"
32
45
  :key="idx"
@@ -62,7 +75,6 @@
62
75
  :reserve-keyword="isRemote(item.remote)"
63
76
  :default-first-option="isRemote(item.remote)"
64
77
  :remote-method="item.remote"
65
-
66
78
  >
67
79
  <el-option
68
80
  v-for="(itemData, idxData) in item.data"
@@ -306,7 +318,8 @@ export default {
306
318
  },
307
319
  setData(key, data) {
308
320
  const row =
309
- this.form.value && this.form.value.find((item) => item.label === key || item.prop === key);
321
+ this.form.value &&
322
+ this.form.value.find((item) => item.label === key || item.prop === key);
310
323
  this.$set(row, "data", data);
311
324
  },
312
325
  setValue(key, value) {
@@ -328,6 +341,13 @@ export default {
328
341
  this.$set(row, "modelVal", value);
329
342
  }
330
343
  },
344
+ onChangeCascader(val,item){
345
+ const newArr = [...new Set(val.flat(Infinity))]
346
+ item.modelVal = newArr
347
+ if(item.options && item.options.change && typeof item.options.change === 'function'){
348
+ item.options.change(newArr,val)
349
+ }
350
+ },
331
351
  },
332
352
  };
333
353
  </script>
@@ -203,7 +203,7 @@ export default {
203
203
  this.idCardSize()
204
204
  },
205
205
  beforeDestroy() {
206
- this.$emit("update:fileList", []);
206
+ // this.$emit("update:fileList", []);
207
207
  },
208
208
  methods: {
209
209
  async idCardSize() {