Skip to content

Commit e6dc6b5

Browse files
committed
feat(MdApp): add support for custom scrollbar
1 parent 4b0cd3c commit e6dc6b5

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

src/components/MdApp/MdAppInternalDrawer.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
<div class="md-app md-app-internal-drawer md-layout-column" :class="appClasses">
33
<slot name="md-app-toolbar"></slot>
44

5-
<main class="md-app-container md-flex md-layout-row" :style="containerStyles">
5+
<main class="md-app-container md-flex md-layout-row" :style="containerStyles" :class="[$mdActiveTheme, scrollerClasses]">
66
<slot name="md-app-drawer"></slot>
7-
<div class="md-app-scroller md-layout-column md-flex">
7+
<div class="md-app-scroller md-layout-column md-flex" :class="[$mdActiveTheme, scrollerClasses]">
88
<slot name="md-app-content"></slot>
99
</div>
1010
</main>
1111
</div>
1212
</template>
1313

1414
<script>
15+
import MdComponent from 'core/MdComponent'
1516
import MdAppMixin from './MdAppMixin'
1617
17-
export default {
18+
export default new MdComponent({
1819
name: 'MdAppInternalDrawer',
1920
mixins: [MdAppMixin]
20-
}
21+
})
2122
</script>
2223

2324
<style lang="scss">

src/components/MdApp/MdAppMixin.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ export default {
2323
}
2424
},
2525
mdWaterfall: Boolean,
26-
mdFlexible: Boolean
26+
mdFlexible: Boolean,
27+
mdScrollbar: {
28+
type: Boolean,
29+
default: true
30+
}
2731
},
2832
data: () => ({
2933
revealTimer: null,
@@ -60,6 +64,11 @@ export default {
6064
}
6165
}
6266
},
67+
scrollerClasses () {
68+
if (this.mdScrollbar) {
69+
return 'md-scrollbar'
70+
}
71+
},
6372
appClasses () {
6473
return {
6574
'md-waterfall': this.mdWaterfall,

src/components/MdApp/MdAppSideDrawer.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
<div class="md-app md-app-side-drawer md-layout-row" :class="appClasses">
33
<slot name="md-app-drawer"></slot>
44

5-
<main class="md-app-container md-flex md-layout-column" :style="containerStyles" @scroll.passive="handleScroll">
5+
<main class="md-app-container md-flex md-layout-column" :style="containerStyles" :class="[$mdActiveTheme, scrollerClasses]" @scroll.passive="handleScroll">
66
<slot name="md-app-toolbar"></slot>
7-
<div class="md-app-scroller md-layout-column md-flex" @scroll.passive="handleScroll">
7+
<div class="md-app-scroller md-layout-column md-flex" :class="[$mdActiveTheme, scrollerClasses]" @scroll.passive="handleScroll">
88
<slot name="md-app-content"></slot>
99
</div>
1010
</main>
1111
</div>
1212
</template>
1313

1414
<script>
15+
import MdComponent from 'core/MdComponent'
1516
import MdAppMixin from './MdAppMixin'
1617
17-
export default {
18+
export default new MdComponent({
1819
name: 'MdAppInternalSideDrawer',
1920
mixins: [MdAppMixin]
20-
}
21+
})
2122
</script>
2223

2324
<style lang="scss">

0 commit comments

Comments
 (0)