Files
mes-ui-d2/src/pages/demo/plugins/better-scroll/base.vue
liyang b6cc361e28 plugin
Former-commit-id: 93988f70554c765330c5193d56441c2604ab4b2d [formerly 93988f70554c765330c5193d56441c2604ab4b2d [formerly 93988f70554c765330c5193d56441c2604ab4b2d [formerly 93988f70554c765330c5193d56441c2604ab4b2d [formerly b710287bd2f9c06410802ad44d54704c085c116d [formerly 7ed4b11f2d9eb703ec9477fe9355a86f9b03b405]]]]]
Former-commit-id: 5303051d0a12181206778f792cefa73f052a7418
Former-commit-id: 33fb08ff3338f98e26949453b75870bd63f5c81f
Former-commit-id: 917ae45092168a1c50df694a4be47676b215f04e [formerly a030aebdbf62b93aaf043ebdc90274711a4bdd6e]
Former-commit-id: af31af61bd8fb7fb73e254bb9abcbc717b895d2e
Former-commit-id: 7e8d8043460886faf57ca65f0db6d8063b60f662
Former-commit-id: ac779841a167a1dc93b5ac6b859e916546059c67
Former-commit-id: dbb3da4b9abae7925c45d12ed4702ede33c21c7b
Former-commit-id: fc004c257a067974e4927c70576fbfd9fec53a15
2018-11-17 11:57:10 +08:00

64 lines
1.2 KiB
Vue

<template>
<d2-container :filename="filename">
<template slot="header">基础用法</template>
<div ref="wrapper" class="demo-bs-wrapper">
<div>
<div v-for="n in 30" :key="n" class="demo-bs-item">n : {{n}}</div>
</div>
</div>
</d2-container>
</template>
<script>
import BScroll from 'better-scroll'
export default {
data () {
return {
filename: __filename,
BS: null
}
},
mounted () {
this.scrollInit()
},
beforeDestroy () {
this.scrollDestroy()
},
methods: {
scrollInit () {
this.BS = new BScroll(this.$refs.wrapper, {
mouseWheel: true,
scrollbar: {
fade: true,
interactive: false
}
})
},
scrollDestroy () {
if (this.BS) {
this.BS.destroy()
}
}
}
}
</script>
<style lang="scss" scoped>
.demo-bs-wrapper {
height: 200px;
width: 300px;
position: relative;
overflow: hidden;
border: 1px solid $color-border-1;
border-radius: 4px;
.demo-bs-item {
line-height: 40px;
padding-left: 10px;
border-bottom: 1px solid $color-border-4;
&:last-child {
border-bottom: none;
}
}
}
</style>