mini-antui
Advanced tools
Comparing version 0.3.2 to 0.3.3-alpha.1
@@ -0,1 +1,4 @@ | ||
var _my$getSystemInfoSync = my.getSystemInfoSync(), | ||
windowWidth = _my$getSystemInfoSync.windowWidth; | ||
Component({ | ||
@@ -9,22 +12,18 @@ props: { | ||
showPlus: false, | ||
swipeable: true | ||
swipeable: true, | ||
activeTab: 0 // 当前激活tab | ||
}, | ||
data: { | ||
scrollInit: 0, | ||
current: 0, | ||
windowWidth: 0, | ||
tabWidth: 0.25 | ||
windowWidth: windowWidth, | ||
tabWidth: 0.25, | ||
autoplay: false, | ||
animation: false | ||
}, | ||
didMount: function didMount() { | ||
var _this = this; | ||
var tabs = this.props.tabs; | ||
my.getSystemInfo({ | ||
success: function success(res) { | ||
_this.setData({ | ||
windowWidth: res.windowWidth, | ||
tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length | ||
}); | ||
} | ||
this.setData({ | ||
tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length, | ||
animation: true, | ||
autoplay: true | ||
}); | ||
@@ -38,9 +37,5 @@ }, | ||
this.moveScrollBar(current); | ||
if (this.props.onChange) { | ||
this.props.onChange({ index: current }); | ||
} | ||
this.setData({ | ||
current: current | ||
}); | ||
}, | ||
@@ -51,9 +46,5 @@ handleTabClick: function handleTabClick(e) { | ||
this.moveScrollBar(index); | ||
if (this.props.onTabClick) { | ||
this.props.onTabClick({ index: index }); | ||
} | ||
this.setData({ | ||
current: index | ||
}); | ||
}, | ||
@@ -64,21 +55,4 @@ handlePlusClick: function handlePlusClick() { | ||
} | ||
}, | ||
moveScrollBar: function moveScrollBar(current) { | ||
var _data = this.data, | ||
windowWidth = _data.windowWidth, | ||
tabWidth = _data.tabWidth; | ||
var scrollInit = current * windowWidth * tabWidth; | ||
if (current <= 2) { | ||
scrollInit = 0; | ||
} else { | ||
scrollInit = (current - 2) * windowWidth * tabWidth; | ||
} | ||
this.setData({ | ||
scrollInit: scrollInit | ||
}); | ||
} | ||
} | ||
}); |
{ | ||
"name": "mini-antui", | ||
"version": "0.3.2", | ||
"version": "0.3.3-alpha.1", | ||
"description": "小程序版AntUI", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
119
0
122848
1882