滚动条问题
为什么滚动条引入到里面拖动不了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | //tab.vue <template> <me-scroll :scrollbar= "false" > <ul class= "tab" > <li class= "tab-item" :class= "{'tab-item-active':item.id===curId}" v- for = "(item,index) in items" :key= "index" @click= "switchTab(item.id)" >{{item.name}} </li> </ul> </me-scroll> </template> <script> import MeScroll from 'base/scroll' import {categoryNames} from './config.js' export default { name: 'CategoryTab' , components:{ MeScroll }, data(){ return { curId: '' } }, created(){ this .init(), this .switchTab( this .items[0].id) }, methods:{ init(){ this .items = categoryNames; }, switchTab(id){ if ( this .curId === id){ return ; } this .curId = id; this .$emit( 'switch-tab' ,id); } } } </script> <style scoped> @import "~assets/scss/mixins" ; $tab-item-height: 46px; .tab{ width: 100%; &-item{ height: $tab-item-height; background-color: #fff; border-right: 1px solid $border-color; border-bottom: 1px solid $border-color; color: #080808; font-size: $font-size-l; font-weight: bold; text-align: center; line-height: $tab-item-height; @include ellipsis(); &:last-child{ border-bottom:none; } } &-item-active{ background: none; border-right: none; color: #f23030; } } </style> //index.vue <template> <div class= "category" > <header class= "g-header-container" > <category-header/> </header> <div class= "g-content-container" > <div class= "sidebar" > <category-tab/> </div> <div class= "main" > </div> </div> </div> </template> <script> import CategoryHeader from './header.vue' import CategoryTab from './tab.vue' export default { name: 'Category' , components:{ CategoryHeader, CategoryTab } }; </script> <style scoped> @import "~assets/scss/mixins" ; .category{ overflow: hidden; width: 100%; height: 100%; background-color: $bgc-theme; } .g-content-container{ display: flex; margin-top: $navbar-height; } .sidebar{ width: 80px; height: 100%; } .main{ flex:1; height: 100%; } </style> |
2
收起
正在回答
2回答
你好同学,将您提供的代码放入源码中,经过测试分类页的侧栏也是可以拖动的
热门框架Vue开发WebApp 18版
- 参与学习 人
- 提交作业 209 份
- 解答问题 3299 个
本路径是通过ES6基础知识、运用Zepto、Swiper、fullPag等移动端常用工具包、以及当下流行框架Vue,结合多个实战案例,还原真实开发场景,最终实现手机端购物商城网页开发。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧