forked from didi/cube-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(index-list): pull up load + pull down refresh (didi#158)
* feat(index-list): pull up load * test * feat(index-list): pull down refresh * test+docs: pull down refresh * optimize: use forceUpdate replace watch deep
- Loading branch information
Showing
11 changed files
with
562 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<template> | ||
<cube-page type="index-list" title="IndexList"> | ||
<div slot="content"> | ||
<div class="view-wrapper"> | ||
<div class="index-list-wrapper"> | ||
<cube-index-list | ||
ref="indexList" | ||
:data="data" | ||
:title="title" | ||
:pullDownRefresh="pullDownRefresh" | ||
@select="selectItem" | ||
@title-click="clickTitle" | ||
@pulling-down="onPullingDown"> | ||
</cube-index-list> | ||
</div> | ||
</div> | ||
</div> | ||
</cube-page> | ||
</template> | ||
|
||
<script type="text/ecmascript-6"> | ||
import CubePage from '../../components/cube-page.vue' | ||
import cityData from '../../data/index-list.json' | ||
export default { | ||
components: { | ||
CubePage | ||
}, | ||
data() { | ||
return { | ||
title: 'Current City: BEIJING', | ||
data: cityData, | ||
pullDownRefresh: { | ||
stop: 55 | ||
} | ||
} | ||
}, | ||
methods: { | ||
selectItem(item) { | ||
console.log(item.name) | ||
}, | ||
clickTitle(title) { | ||
console.log(title) | ||
}, | ||
onPullingDown() { | ||
// Mock async load. | ||
setTimeout(() => { | ||
// Update data. | ||
this.data[1].items.push(...cityData[1].items) | ||
// Call forceUpdate after finishing data load. | ||
this.$refs.indexList.forceUpdate() | ||
}, 1000) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="stylus" rel="stylesheet/stylus"> | ||
.view-wrapper | ||
position: fixed | ||
top: 54px | ||
left: 0 | ||
bottom: 0 | ||
width: 100% | ||
.index-list-wrapper | ||
height: 98% | ||
width: 94% | ||
margin: 0 auto | ||
overflow: hidden | ||
</style> |
Oops, something went wrong.