Skip to content

Commit 0b746e5

Browse files
author
Pablo Henrique
authored
Merge pull request vuematerial#844 from guijavax/change-cardexpand
Fixed issue vuematerial#803
2 parents aec7f58 + 2d6b96a commit 0b746e5

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/components/mdCard/mdCard.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ $card-radius: 2px;
194194
}
195195
}
196196

197+
197198
.md-card-actions {
198199
padding: 8px;
199200
display: flex;
@@ -285,6 +286,8 @@ $card-radius: 2px;
285286
.md-card-content {
286287
margin-top: 0 !important;
287288
opacity: 1;
289+
padding: 4px 16px 24px 16px ;
290+
height: auto;
288291
}
289292
}
290293

@@ -300,13 +303,14 @@ $card-radius: 2px;
300303
}
301304

302305
.md-card-content {
303-
padding-top: 4px;
306+
height: 0;
307+
padding: 0 16px;
304308
position: relative;
305309
z-index: 1;
306310
opacity: 0;
307311
transform: translate3D(0, 0, 0);
308312
transition: $swift-ease-out;
309-
will-change: margin;
313+
will-change: margin, height;
310314
}
311315
}
312316
}

src/components/mdCard/mdCardExpand.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<template>
2-
<div class="md-card-expand" ref="expand">
2+
<div class="md-card-expand"
3+
ref="expand">
34
<slot></slot>
45
</div>
56
</template>
67

78
<script>
89
export default {
910
name: 'md-card-expand',
11+
data() {
12+
return {
13+
trigger: null,
14+
content: null
15+
};
16+
},
1017
methods: {
11-
setContentMargin() {
12-
this.content.style.marginTop = -this.content.offsetHeight + 'px';
13-
},
1418
toggle() {
1519
this.$refs.expand.classList.toggle('md-active');
16-
},
17-
onWindowResize() {
18-
window.requestAnimationFrame(this.setContentMargin);
1920
}
2021
},
2122
mounted() {
@@ -24,17 +25,13 @@
2425
this.content = this.$el.querySelector('.md-card-content');
2526
2627
if (this.content) {
27-
this.setContentMargin();
28-
2928
this.trigger.addEventListener('click', this.toggle);
30-
window.addEventListener('resize', this.onWindowResize);
3129
}
3230
}, 200);
3331
},
3432
destroyed() {
3533
if (this.content) {
3634
this.trigger.removeEventListener('click', this.toggle);
37-
window.removeEventListener('resize', this.onWindowResize);
3835
}
3936
}
4037
};

0 commit comments

Comments
 (0)