Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

better-scroll切换页面问题

使用这个滑动组件 刚开始没问题。后来才发现滑动只管一次加载的尺寸,切换成第二个页面直接就不动了!

请诸位告诉我详细解决方法!

<template>
    <div class="section">
        <div class="section-right" ref="scroll">
               <keep-alive>
                    <component :is="mds" class="mds"></component>
               </keep-alive>
        </div>
    </div>
</template>

<script>
    import BetterScroll from 'better-scroll'
    export default {
        data() {
            return {
                list: [
                    {name:'Vue', link:'md1'},
                    {name:'jQuery', link:'md2'},
                    {name:'uniapp', link:'md3'},
                ],
                activeName: 'Vue',
                mds:'md1'
            }
        },
        components: {
            'md1': () => import("../views/mds/1.md"),
            'md2': () => import("../views/mds/2.md"),
            'md3': () => import("../views/mds/3.md"),

        },
        mounted() {
           this.$nextTick(()=>{
               setTimeout(()=>{
                   this.$refs.scroll =  new BetterScroll(this.$refs.scroll, {
                            mouseWheel: true,
                            scrollY: true,
                            scrollbar: true,
                            click:true,
                            tap:true
                        }) 
               }, 1000)         
              })
        }
    }
</script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...