41 lines
615 B
Vue
41 lines
615 B
Vue
<script>
|
|
import BScroll from '@better-scroll/core';
|
|
|
|
export default {
|
|
mounted() {
|
|
this.$nextTick(() => {
|
|
this.bs = new BScroll(this.$refs.wrapper, {
|
|
scrollX: true,
|
|
scrollY: false,
|
|
click: true,
|
|
bounce: false
|
|
})
|
|
})
|
|
},
|
|
beforeDestroy() {
|
|
this.bs && this.bs.destroy()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div ref="wrapper" class="btn-wrapper">
|
|
<div class="btn-content">
|
|
<slot></slot>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.btn-wrapper {
|
|
overflow: hidden;
|
|
position: relative;
|
|
width: 100%
|
|
}
|
|
.btn-content {
|
|
white-space: nowrap;
|
|
display: inline-block;
|
|
width: max-content;
|
|
}
|
|
</style>
|