index.wxml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <view class="i-index i-class">
  2. <scroll-view
  3. scroll-y
  4. style="{{parse.setScrollStyle(height)}}"
  5. bindscroll="handlerScroll"
  6. scroll-top="{{scrollTop}}">
  7. <slot></slot>
  8. <view class="i-index-fixed"
  9. catchtouchstart="handlerTouchMove"
  10. catchtouchmove="handlerTouchMove"
  11. catchtouchend="handlerTouchEnd">
  12. <view class="i-index-fixed-item"
  13. wx:for="{{fixedData}}"
  14. wx:key="{{index}}"
  15. data-index="{{index}}"
  16. catchtap="handlerFixedTap">
  17. {{item}}
  18. </view>
  19. </view>
  20. <view class="i-index-tooltip" style="{{ isTouches ? 'display:block' : 'display:none' }}">{{currentName}}</view>
  21. </scroll-view>
  22. </view>
  23. <wxs module="parse">
  24. module.exports = {
  25. setScrollStyle : function(height){
  26. var units = ['%','px','rem','rpx','em','rem'];
  27. var hasUnits = false;
  28. for( var i = 0; i < units.length;i++ ){
  29. var u = units[i];
  30. if( height.indexOf( u ) > -1 ){
  31. hasUnits = true;
  32. break;
  33. }
  34. }
  35. return 'height:'+ ( hasUnits ? height : height+'px' );
  36. }
  37. }
  38. </wxs>