mini-viewpager
v0.0.2
Published
[![npm](https://img.shields.io/npm/v/mini-viewpager.svg)](https://www.npmjs.com/package/mini-viewpager) [![Package Control](https://img.shields.io/packagecontrol/dm/mini-viewpager.svg)](https://github.com/mini-plug/mini-ViewPager.git) ![GitHub last commi
Downloads
5
Readme
mini-viewpager
使用方法
npm i mini-viewpager
oryarn add mini-viewpager
在
Page
的json文件内添加配置{ "usingComponents": { "viewpager": "mini-viewpager/viewpager", "tabIndicator": "mini-viewpager/tabIndicator" } }
<tabIndicator tab="{{tab}}" bind:onTabSelect='onTabSelect' currentIndex="{{tabCurrentIndex}}"> </tabIndicator> <viewpager currentIndex="{{currentIndex}}" count="{{tab.length}}" onPagerChange="{{onPagerChange}}"> <block wx:for="{{tab}}" wx:for-item="item" wx:key="{{index}}"> <view slot="viewpager-{{index}}">{{item.name}}</view> </block> </viewpager>
属性
properties
字段名|类型|必填|描述 :----:|:----:|:----:|:----: tab|Array|是|tab显示的内容 currentIndex|Number|是|当前需要显示的index count|Number|是|数量,与tab数量对应 bind:onTabSelect|Function|否|状态回调 onPagerChange|Function|否|状态回调
测试
`npm run dev`