Skip to content

Commit

Permalink
Scroll add local loading-text
Browse files Browse the repository at this point in the history
  • Loading branch information
icarusion committed Oct 16, 2017
1 parent 109465d commit 78b46fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/routers/scroll.vue
@@ -1,5 +1,5 @@
<template>
<Scroll :on-reach-top="loadData" loading-text="L-o-a-d-i-n-g...">
<Scroll :on-reach-edge="loadData">
<section v-for="item in list">
<div class="city">
<p>{{ item }}</p>
Expand Down
19 changes: 13 additions & 6 deletions src/components/scroll/scroll.vue
Expand Up @@ -9,13 +9,13 @@
ref="scrollContainer"
>
<div :class="loaderClasses" :style="{paddingTop: wrapperPadding.paddingTop}" ref="toploader">
<loader :text="loadingText" :active="showTopLoader"></loader>
<loader :text="localeLoadingText" :active="showTopLoader"></loader>
</div>
<div :class="slotContainerClasses" ref="scrollContent">
<slot></slot>
</div>
<div :class="loaderClasses" :style="{paddingBottom: wrapperPadding.paddingBottom}" ref="bottomLoader">
<loader :text="loadingText" :active="showBottomLoader"></loader>
<loader :text="localeLoadingText" :active="showBottomLoader"></loader>
</div>
</div>
</div>
Expand All @@ -24,6 +24,7 @@
import throttle from 'lodash.throttle';
import loader from './loading-component.vue';
import { on, off } from '../../utils/dom';
import Locale from '../../mixins/locale';
const prefixCls = 'ivu-scroll';
const dragConfig = {
Expand All @@ -35,7 +36,7 @@
export default {
name: 'Scroll',
mixins: [],
mixins: [ Locale ],
components: {loader},
props: {
height: {
Expand All @@ -52,8 +53,7 @@
type: Function
},
loadingText: {
type: String,
default: ''
type: String
}
},
data() {
Expand Down Expand Up @@ -98,7 +98,14 @@
paddingTop: this.topRubberPadding + 'px',
paddingBottom: this.bottomRubberPadding + 'px'
};
}
},
localeLoadingText () {
if (this.loadingText === undefined) {
return this.t('i.select.loading');
} else {
return this.loadingText;
}
},
},
methods: {
// just to improve feeling of loading and avoid scroll trailing events fired by the browser
Expand Down

0 comments on commit 78b46fa

Please sign in to comment.