bri-components 1.2.9 → 1.2.10

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": "bri-components",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -126,7 +126,9 @@
126
126
  @on-visible-change="visibleChange"
127
127
  @on-change="changeVal"
128
128
  @click.stop="clickCascader"
129
- ></Cascader>
129
+ >
130
+ <slot></slot>
131
+ </Cascader>
130
132
  </template>
131
133
  </template>
132
134
  </template>
@@ -394,6 +396,9 @@
394
396
  if (this.isVisible || !val.length) {
395
397
  this.curValList = val;
396
398
  }
399
+
400
+ // 注:...params 参数不可去单独使用地区组件时调用
401
+ this.$emit("change", this.value[this.controlKey], ...params);
397
402
  }
398
403
  },
399
404
  watch: {
@@ -49,6 +49,7 @@
49
49
  <template v-else>
50
50
  <bri-tooltip
51
51
  :content="showVal"
52
+ :defaultDisabled="false"
52
53
  maxWidth="200"
53
54
  :transfer="true"
54
55
  >
@@ -26,6 +26,7 @@ export default {
26
26
  }
27
27
  },
28
28
  /* 列表形式下用到的 */
29
+ rowIndex: Number,
29
30
  parentData: {
30
31
  type: Array,
31
32
  default () {
@@ -2,18 +2,13 @@
2
2
  <Tooltip
3
3
  class="BriTooltip"
4
4
  style="width: 100%;"
5
- :disabled="disabled"
6
5
  :content="content"
6
+ :disabled="toolTipDisabled"
7
7
  :placement="placement"
8
- :transfer="transfer"
9
8
  :max-width="maxWidth"
9
+ :transfer="transfer"
10
10
  >
11
- <div
12
- ref="ellipsisContent"
13
- class="ellipsisContent"
14
- >
15
- <slot></slot>
16
- </div>
11
+ <slot></slot>
17
12
 
18
13
  <slot
19
14
  slot="content"
@@ -27,12 +22,6 @@
27
22
  name: "BriTooltip",
28
23
  props: {
29
24
  content: String,
30
- propsObj: {
31
- type: Object,
32
- default () {
33
- return {};
34
- }
35
- },
36
25
  placement: {
37
26
  type: String,
38
27
  default: "bottom"
@@ -44,44 +33,48 @@
44
33
  transfer: {
45
34
  type: Boolean,
46
35
  default: false
36
+ },
37
+
38
+ defaultDisabled: {
39
+ type: Boolean,
40
+ default: true
47
41
  }
48
42
  },
49
43
  data () {
50
44
  return {
51
- disabled: false
45
+ toolTipDisabled: true,
46
+ tmpToolTipDisabled: true
52
47
  };
53
48
  },
54
- computed: {},
55
- methods: {
56
- computedDisable () {
57
- // 获取overflow:hidden元素的实际被撑开的宽度
58
- let test = this.$refs.ellipsisContent;
59
- if (test) {
60
- let cp = test.cloneNode(true);
61
- cp.style.cssText = "all: unset;position: absolute;opacity:0;";
62
- test.parentElement.appendChild(cp);
63
- let realWidth = cp.offsetWidth;
64
- cp.remove();
65
- this.disabled = realWidth <= test.offsetWidth;
66
- }
67
- }
49
+ created () {
50
+ this.toolTipDisabled = this.defaultDisabled;
51
+ this.tmpToolTipDisabled = this.toolTipDisabled;
68
52
  },
69
- created () {},
70
53
  mounted () {
71
- this.$nextTick(() => {
72
- this.computedDisable();
73
- });
54
+ this.getToolTipDisabled("mouted");
74
55
  },
75
56
  updated () {
76
- this.$nextTick(() => {
77
- this.computedDisable();
78
- });
57
+ this.getToolTipDisabled("updated");
79
58
  },
80
- watch: {
81
- content () {
82
- this.$nextTick(() => {
83
- this.computedDisable();
84
- });
59
+ methods: {
60
+ getToolTipDisabled (type) {
61
+ const isOverflow = this.$slots.default;
62
+ const toolTipDisabled = isOverflow[0]
63
+ ? !(isOverflow[0].elm.scrollWidth > isOverflow[0].elm.clientWidth)
64
+ : this.toolTipDisabled;
65
+
66
+ if (toolTipDisabled !== this.toolTipDisabled) {
67
+ if (toolTipDisabled !== this.tmpToolTipDisabled) {
68
+ this.tmpToolTipDisabled = toolTipDisabled;
69
+
70
+ this.timer = setTimeout(() => {
71
+ this.toolTipDisabled = toolTipDisabled;
72
+ this.tmpToolTipDisabled = this.toolTipDisabled;
73
+ }, 2000);
74
+ }
75
+ } else {
76
+ clearTimeout(this.timer);
77
+ }
85
78
  }
86
79
  }
87
80
  };
@@ -23,6 +23,7 @@
23
23
  size: 'default',
24
24
  inTable: true
25
25
  }"
26
+ :rowIndex="rowIndex"
26
27
  :parentData="parentData"
27
28
  @blur="blur"
28
29
  @change="change"
@@ -6,12 +6,12 @@
6
6
  }
7
7
 
8
8
  .ivu-tooltip-inner {
9
+ padding: 5px 8px;
9
10
  border-radius: 4px;
10
11
  background: rgba(0, 0, 0, 0.9);
11
- color: rgba(255, 255, 255, 0.9);
12
12
  font-size: 14px;
13
13
  font-weight: 400;
14
- padding: 5px 8px;
14
+ color: rgba(255, 255, 255, 0.9);
15
15
  }
16
16
 
17
17
  .ivu-tooltip-rel {