cy-element-ui 1.0.77 → 1.0.79

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/src/index.js CHANGED
@@ -221,7 +221,7 @@ if (typeof window !== 'undefined' && window.Vue) {
221
221
  }
222
222
 
223
223
  export default {
224
- version: '1.0.77',
224
+ version: '1.0.79',
225
225
  locale: locale.use,
226
226
  i18n: locale.i18n,
227
227
  install,
@@ -1,81 +0,0 @@
1
- <script>
2
-
3
- export default {
4
- props: {
5
- isAutoWidth: Boolean,
6
- updateAll: Boolean
7
- },
8
-
9
- inject: ['elForm', 'elFormItem'],
10
-
11
- render: function(h) {
12
- var slots = this.$slots.default;
13
- if (!slots) return null;
14
- if (this.isAutoWidth) {
15
- var autoLabelWidth = this.elForm.autoLabelWidth;
16
- var style = {};
17
- if (autoLabelWidth && autoLabelWidth !== 'auto') {
18
- var marginLeft = parseInt(autoLabelWidth, 10) - this.computedWidth;
19
- if (marginLeft) {
20
- style.marginLeft = marginLeft + 'px';
21
- }
22
- }
23
- return h(
24
- 'div',
25
- { 'class': 'el-form-item__label-wrap', style: style },
26
- [slots]
27
- );
28
- } else {
29
- return slots[0];
30
- }
31
- },
32
-
33
- methods: {
34
- getLabelWidth: function() {
35
- if (this.$el && this.$el.firstElementChild) {
36
- var computedWidth = window.getComputedStyle(this.$el.firstElementChild).width;
37
- return Math.ceil(parseFloat(computedWidth));
38
- } else {
39
- return 0;
40
- }
41
- },
42
- updateLabelWidth: function(action) {
43
- action = action || 'update';
44
- if (this.$slots.default && this.isAutoWidth && this.$el.firstElementChild) {
45
- if (action === 'update') {
46
- this.computedWidth = this.getLabelWidth();
47
- } else if (action === 'remove') {
48
- this.elForm.deregisterLabelWidth(this.computedWidth);
49
- }
50
- }
51
- }
52
- },
53
-
54
- watch: {
55
- computedWidth: function(val, oldVal) {
56
- if (this.updateAll) {
57
- this.elForm.registerLabelWidth(val, oldVal);
58
- this.elFormItem.updateComputedLabelWidth(val);
59
- }
60
- }
61
- },
62
-
63
- data: function() {
64
- return {
65
- computedWidth: 0
66
- };
67
- },
68
-
69
- mounted: function() {
70
- this.updateLabelWidth('update');
71
- },
72
-
73
- updated: function() {
74
- this.updateLabelWidth('update');
75
- },
76
-
77
- beforeDestroy: function() {
78
- this.updateLabelWidth('remove');
79
- }
80
- };
81
- </script>