Commit 78b46fa61946fde4d0004b4c263633e794bb6b41
1 parent
109465d3
Scroll add local loading-text
Showing
2 changed files
with
14 additions
and
7 deletions
Show diff stats
examples/routers/scroll.vue
src/components/scroll/scroll.vue
| ... | ... | @@ -9,13 +9,13 @@ |
| 9 | 9 | ref="scrollContainer" |
| 10 | 10 | > |
| 11 | 11 | <div :class="loaderClasses" :style="{paddingTop: wrapperPadding.paddingTop}" ref="toploader"> |
| 12 | - <loader :text="loadingText" :active="showTopLoader"></loader> | |
| 12 | + <loader :text="localeLoadingText" :active="showTopLoader"></loader> | |
| 13 | 13 | </div> |
| 14 | 14 | <div :class="slotContainerClasses" ref="scrollContent"> |
| 15 | 15 | <slot></slot> |
| 16 | 16 | </div> |
| 17 | 17 | <div :class="loaderClasses" :style="{paddingBottom: wrapperPadding.paddingBottom}" ref="bottomLoader"> |
| 18 | - <loader :text="loadingText" :active="showBottomLoader"></loader> | |
| 18 | + <loader :text="localeLoadingText" :active="showBottomLoader"></loader> | |
| 19 | 19 | </div> |
| 20 | 20 | </div> |
| 21 | 21 | </div> |
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | import throttle from 'lodash.throttle'; |
| 25 | 25 | import loader from './loading-component.vue'; |
| 26 | 26 | import { on, off } from '../../utils/dom'; |
| 27 | + import Locale from '../../mixins/locale'; | |
| 27 | 28 | |
| 28 | 29 | const prefixCls = 'ivu-scroll'; |
| 29 | 30 | const dragConfig = { |
| ... | ... | @@ -35,7 +36,7 @@ |
| 35 | 36 | |
| 36 | 37 | export default { |
| 37 | 38 | name: 'Scroll', |
| 38 | - mixins: [], | |
| 39 | + mixins: [ Locale ], | |
| 39 | 40 | components: {loader}, |
| 40 | 41 | props: { |
| 41 | 42 | height: { |
| ... | ... | @@ -52,8 +53,7 @@ |
| 52 | 53 | type: Function |
| 53 | 54 | }, |
| 54 | 55 | loadingText: { |
| 55 | - type: String, | |
| 56 | - default: '' | |
| 56 | + type: String | |
| 57 | 57 | } |
| 58 | 58 | }, |
| 59 | 59 | data() { |
| ... | ... | @@ -98,7 +98,14 @@ |
| 98 | 98 | paddingTop: this.topRubberPadding + 'px', |
| 99 | 99 | paddingBottom: this.bottomRubberPadding + 'px' |
| 100 | 100 | }; |
| 101 | - } | |
| 101 | + }, | |
| 102 | + localeLoadingText () { | |
| 103 | + if (this.loadingText === undefined) { | |
| 104 | + return this.t('i.select.loading'); | |
| 105 | + } else { | |
| 106 | + return this.loadingText; | |
| 107 | + } | |
| 108 | + }, | |
| 102 | 109 | }, |
| 103 | 110 | methods: { |
| 104 | 111 | // just to improve feeling of loading and avoid scroll trailing events fired by the browser | ... | ... |