stylus
一种css预处理器,可以更加直观的编写css代码,减少不必要的格式
下载:
npm install stylus
使用:
在style标签中加上 lang="stylus"来使用stylus
样式不再需要大括号,而是用缩进来代替
可以省略冒号,用空格代替
不再需要分号来结尾
在style标签中添加scope属性后,样式只会修饰当前组件。
better-scroll
一个用于提高滑动体验的库,可以让移动端的滑动体验更接近于原生APP
下载:仍然是npm下载或script标签引入,没什么好说的
使用也非常简单:
首先 import BScroll from ‘better-scroll’
this.scroll=new Bscroll(this.$refs.wrapper)//wrapper是被选择的元素,也就是进行滚动的元素,完成绑定即成功使用
绑定成功后,要进行元素跳转时,可以用this.scroll.scrollToElement()的方法,括号内的参数是要跳转到的目标
swipper
用于实现轮播图的插件,类似于这样的:
下载:npm install swiper,或是去官网下载压缩包后引入对应的js文件和css文件
使用:通过一段示例demo来看,这是swipper.vue:
<template style="touch-action:none;">
<swiper :options="swiperOption" class=wrapper>
<swiper-slide v-for="item of swiperList" :key="item.id">
<img class="swiper-img" v-bind:src="item.imgUrl">
</swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
<div class="swiper-button-prev" slot="button-prev"></div>
<div class="swiper-button-next" slot=