12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- Component({
- properties: {
- list:{
- type:Object,
- observer:function(list){
- this.setData({ list });
- }
- },
- share:{
- type:Boolean,
- observer: function (share){
- this.setData({ share });
- }
- },
- showMedal:{
- type:Boolean,
- observer:function(newVal){
- console.log(newVal)
- this.setData({ showMedal:newVal });
- }
- },
- },
- data: {
- list:[],
- showMedal:false,
- share:false,
- scrollLeft:0,
- current:0,
- cardWidth:wx.getSystemInfoSync().windowWidth,
- disable:true,
- left:0,
- current:0
- },
- methods: {
- bindchange(e){
- let current = e.detail.current;
- this.setData({current})
- this.triggerEvent('getChildIndex', current );
- },
- rightScroll(){
- if (this.data.list.length>1) {
- this.setData({current:this.data.current>=this.data.list.length-1?0:this.data.current+1})
- }
- },
- leftScroll(){
- if (this.data.list.length>1) {
- this.setData({current:this.data.current<=0?this.data.list.length-1:this.data.current-1})
- }
- }
- }
- })
|