mirror of
https://github.com/weilanwl/coloruicss.git
synced 2026-06-08 15:23:17 +08:00
xiaogang
ColorUI 源代码
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// pages/document/slider/slider.js
|
||||
Page({
|
||||
data: {
|
||||
scrollInto: 0,
|
||||
scrollList: [
|
||||
{ id: '1' },
|
||||
{ id: '2' },
|
||||
{ id: '3' },
|
||||
{ id: '1' },
|
||||
{ id: '2' },
|
||||
{ id: '3' },
|
||||
{ id: '4' },
|
||||
{ id: '1' },
|
||||
{ id: '2' }]
|
||||
},
|
||||
scrollLeft: function (e) {
|
||||
var into = this.data.scrollInto;
|
||||
var length = this.data.scrollList.length;
|
||||
if (into > 0) {
|
||||
this.setData({
|
||||
scrollInto: into - 1,
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
scrollInto: length - 3,
|
||||
})
|
||||
}
|
||||
},
|
||||
scrollRight: function (e) {
|
||||
var into = this.data.scrollInto;
|
||||
if (into < this.data.scrollList.length - 3) {
|
||||
this.setData({
|
||||
scrollInto: into + 1,
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
scrollInto: 0,
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user