Commit 32e359dfa2d4dc2c392f46b9a09623787766c40b

Authored by liuqimichale
1 parent 120cce1d

betterScroll

package-lock.json
... ... @@ -1265,6 +1265,15 @@
1265 1265 "tweetnacl": "^0.14.3"
1266 1266 }
1267 1267 },
  1268 + "better-scroll": {
  1269 + "version": "1.13.2",
  1270 + "resolved": "http://registry.npm.taobao.org/better-scroll/download/better-scroll-1.13.2.tgz",
  1271 + "integrity": "sha1-MebgiM8tI85I5S+tbMWRNP/rL1Y=",
  1272 + "dev": true,
  1273 + "requires": {
  1274 + "babel-runtime": "^6.0.0"
  1275 + }
  1276 + },
1268 1277 "bfj-node4": {
1269 1278 "version": "5.3.1",
1270 1279 "resolved": "http://registry.npm.taobao.org/bfj-node4/download/bfj-node4-5.3.1.tgz",
... ...
package.json
... ... @@ -25,6 +25,7 @@
25 25 "babel-plugin-transform-vue-jsx": "^3.5.0",
26 26 "babel-preset-env": "^1.3.2",
27 27 "babel-preset-stage-2": "^6.22.0",
  28 + "better-scroll": "^1.13.2",
28 29 "chalk": "^2.0.1",
29 30 "copy-webpack-plugin": "^4.0.1",
30 31 "css-loader": "^0.28.11",
... ...
src/views/mapsection.vue
... ... @@ -35,14 +35,18 @@
35 35 <li>正常</li>
36 36 <li>空闲</li>
37 37 </ul>
38   - <ul class="park-wrap">
39   - <li v-for="(item, index) in parkList" :key="index" :title="item.name" :class="{'current-active':index===currentIndex}" @click="currentPark(item, index)">{{ item.name }}</li>
40   - </ul>
  38 + <div class="park-wrap" ref="parkwrap">
  39 + <ul class="content" ref="">
  40 + <li v-for="(item, index) in parkList" :key="index" :title="item.name" :class="{'current-active':index===currentIndex}" @click="currentPark(item, index)">{{ item.name }}</li>
  41 + </ul>
  42 + </div>
41 43 <div class="flexfm" ></div>
42 44 </div>
43 45 </template>
44 46  
45 47 <script>
  48 +import BScroll from 'better-scroll'
  49 +
46 50 export default {
47 51 name: 'mapsection',
48 52 data() {
... ... @@ -69,8 +73,14 @@ export default {
69 73 currentIndex:0
70 74 }
71 75 },
72   - created() {
73   -
  76 + mounted() {
  77 + this.$nextTick(() => {
  78 + this.scroll = new BScroll(this.$refs.parkwrap,{
  79 + scrollbars:true,//显示滚动条(默认是false不显示)
  80 + mouseWheel:true,//支持鼠标触发区域滚动
  81 + bounce:true,//取消达到边界的缓冲效果
  82 + })
  83 + })
74 84 },
75 85 methods: {
76 86 currentPark(item, index) {
... ... @@ -159,23 +169,28 @@ export default {
159 169 bottom: 11px;
160 170 background-color: #0D3689;
161 171 font-size: 12px;
162   - overflow-y: auto;
163   - li{
164   - padding-left: 26px;
165   - height: 20px;
166   - line-height: 20px;
167   - color:rgba(255,255,255,.7);
168   - background-image:url("../assets/img/office-icon.png");
169   - background-repeat: no-repeat;
170   - background-position: 9px center;
171   - overflow: hidden;
172   - white-space: nowrap;
173   - text-overflow: ellipsis;
174   - cursor: pointer;
175   - }
176   - .current-active{
177   - color:rgba(255,255,255,1);
178   - background-image:url("../assets/img/officeactive-icon.png");
  172 + overflow: hidden;
  173 +
  174 + .content{
  175 + height:100%;
  176 + li{
  177 + padding-left: 26px;
  178 + height: 20px;
  179 + line-height: 20px;
  180 + color:rgba(255,255,255,.7);
  181 + background-image:url("../assets/img/office-icon.png");
  182 + background-repeat: no-repeat;
  183 + background-position: 9px center;
  184 + overflow: hidden;
  185 + white-space: nowrap;
  186 + text-overflow: ellipsis;
  187 + cursor: pointer;
  188 + }
  189 + .current-active{
  190 + color:rgba(255,255,255,1);
  191 + background-image:url("../assets/img/officeactive-icon.png");
  192 + }
179 193 }
  194 +
180 195 }
181 196 </style>
... ...