message: [new feature] List: add direction prop
diff: @@ -29,6 +29,10 @@ export default sfc({
  offset: {
  type: Number,
  default: 300
  + },
  + direction: {
  + type: String,
  + default: 'down'
  }
  },
  @@ -74,25 +78,37 @@ export default sfc({
  const scrollerHeight = getVisibleHeight(scroller);
  /* istanbul ignore next */
  - if (!scrollerHeight || window.getComputedStyle(el).display === 'none' || el.offsetParent === null) {
  + if (
  + !scrollerHeight ||
  + window.getComputedStyle(el).display === 'none' ||
  + el.offsetParent === null
  + ) {
  return;
  }
  - const scrollTop = getScrollTop(scroller);
  + const { offset, direction } = this;
  +
  + function isReachEdge() {
  + if (el === scroller) {
  + const scrollTop = getScrollTop(el);
  +
  + if (direction === 'up') {
  + return scrollTop <= offset;
  + }
  +
  const targetBottom = scrollTop + scrollerHeight;
  + return scroller.scrollHeight - targetBottom <= offset;
  + }
  - let reachBottom = false;
  + if (direction === 'up') {
  + return getScrollTop(scroller) - getElementTop(el) <= offset;
  + }
  - /* istanbul ignore next */
  - if (el === scroller) {
  - reachBottom = scroller.scrollHeight - targetBottom < this.offset;
  - } else {
  - const elBottom = getElementTop(el) - getElementTop(scroller) + getVisibleHeight(el);
  - reachBottom = elBottom - scrollerHeight < this.offset;
  + const elBottom = getElementTop(el) + getVisibleHeight(el) - getElementTop(scroller);
  + return elBottom - scrollerHeight <= offset;
  }
  - /* istanbul ignore else */
  - if (reachBottom) {
  + if (isReachEdge()) {
  this.$emit('input', true);
  this.$emit('load');
  }
  @@ -115,7 +131,7 @@ export default sfc({
  render(h) {
  return (
  <div class={bem()}>
  - {this.slots()}
  + {this.direction === 'down' && this.slots()}
  {this.loading && (
  <div class={bem('loading')} key="loading">
  {this.slots('loading') || [
  @@ -132,6 +148,7 @@ export default sfc({
  {this.errorText}
  </div>
  )}
  + {this.direction === 'up' && this.slots()}
  </div>
  );
  }
  