Skip to content

Commit a2511ac

Browse files
committed
delay creation of ripple actions
1 parent eed652e commit a2511ac

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

src/core/components/mdInkRipple/mdInkRipple.vue

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="md-ink-ripple" v-if="!disabled">
2+
<div class="md-ink-ripple" v-if="mounted || !disabled">
33
<div class="md-ripple" :class="classes" :style="styles" ref="ripple"></div>
44
</div>
55
</template>
@@ -12,6 +12,7 @@
1212
mdDisabled: Boolean
1313
},
1414
data: () => ({
15+
mounted: false,
1516
rippleElement: null,
1617
parentElement: null,
1718
parentDimensions: {
@@ -144,19 +145,17 @@
144145
}
145146
},
146147
init() {
147-
this.$nextTick(() => {
148-
this.rippleElement = this.$el;
149-
this.parentElement = this.getClosestPositionedParent(this.$el.parentNode);
150-
151-
if (!this.parentElement) {
152-
this.$destroy();
153-
} else {
154-
this.rippleElement.parentNode.removeChild(this.rippleElement);
155-
this.parentElement.appendChild(this.rippleElement);
156-
this.registerMouseEvent();
157-
this.setDimensions();
158-
}
159-
});
148+
this.rippleElement = this.$el;
149+
this.parentElement = this.getClosestPositionedParent(this.$el.parentNode);
150+
151+
if (!this.parentElement) {
152+
this.$destroy();
153+
} else {
154+
this.rippleElement.parentNode.removeChild(this.rippleElement);
155+
this.parentElement.appendChild(this.rippleElement);
156+
this.registerMouseEvent();
157+
this.setDimensions();
158+
}
160159
},
161160
destroy() {
162161
if (this.rippleElement && this.rippleElement.parentNode) {
@@ -166,11 +165,17 @@
166165
}
167166
},
168167
mounted() {
169-
if (!this.disabled) {
170-
this.init();
171-
} else {
172-
this.destroy();
173-
}
168+
window.setTimeout(() => {
169+
if (!this.disabled) {
170+
this.init();
171+
} else {
172+
this.destroy();
173+
}
174+
175+
this.$nextTick(() => {
176+
this.mounted = true;
177+
});
178+
}, 100);
174179
},
175180
beforeDestroy() {
176181
this.destroy();

0 commit comments

Comments
 (0)