|
| 1 | +<template> |
| 2 | + <Page loaded="pageLoaded" ref="page"> |
| 3 | + <ActionBar class="action-bar" title="Hello"> |
| 4 | + <NavigationButton text="Go Back" android.systemIcon="ic_menu_back" @tap="$navigateBack" /> |
| 5 | + </ActionBar> |
| 6 | + <FlexboxLayout flexDirection="column" backgroundColor="#3c495e" @pan="onDrawerPan(side, $event)"> |
| 7 | + <!-- <Label class="first" text="first" height="70" backgroundColor="#43b883" ref="ht" flexShrink="0" /> |
| 8 | + <Label text="second" height="70" backgroundColor="#1c6b48" flexShrink="0" /> --> |
| 9 | + <!-- <Label text="third" height="100%" backgroundColor="#289062" /> --> |
| 10 | + <ListView for="item in listArr" ref="list" @pan="onListPane(side,$event)"> |
| 11 | + <v-template> |
| 12 | + <Label :text="item" class="icon" /> |
| 13 | + </v-template> |
| 14 | + </ListView> |
| 15 | + </FlexboxLayout> |
| 16 | + <GridLayout colums="*" rows="*"> |
| 17 | + <Label class="message" :text="msg" col="0" row="0" /> |
| 18 | + <PullToRefresh @refresh="refreshList"> |
| 19 | + <ListView for="item in listArr"> |
| 20 | + <v-template> |
| 21 | + <Label :text="item" class="icon" /> |
| 22 | + </v-template> |
| 23 | + </ListView> |
| 24 | + </PullToRefresh> |
| 25 | + </GridLayout> |
| 26 | + </Page> |
| 27 | +</template> |
| 28 | + |
| 29 | +<script> |
| 30 | +export default { |
| 31 | + data () { |
| 32 | + return { |
| 33 | + msg: "Hello World! ", |
| 34 | + listArr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], |
| 35 | + num: 0, |
| 36 | + isStart: false, |
| 37 | + isTime: true, |
| 38 | + }; |
| 39 | + }, |
| 40 | + mounted () { |
| 41 | + this.pageLoaded(); |
| 42 | + }, |
| 43 | + methods: { |
| 44 | + pageLoaded: function (args) { |
| 45 | +
|
| 46 | + }, |
| 47 | + await: function () { |
| 48 | + console.log('丁丁事') |
| 49 | + let that = this; |
| 50 | + setTimeout(function () { |
| 51 | + console.log('对不起, 要你久候') |
| 52 | + that.isTime = true; |
| 53 | + console.log('定时了'); |
| 54 | + }, 3000) |
| 55 | + }, |
| 56 | + // refreshList (args) { |
| 57 | + // var pullRefresh = args.object; |
| 58 | + // let that = this; |
| 59 | + // setTimeout(function () { |
| 60 | + // pullRefresh.refreshing = false; |
| 61 | + // that.isTime = true; |
| 62 | + // console.log('定时了'); |
| 63 | + // }, 1000); |
| 64 | + // }, |
| 65 | + onButton: function () { }, |
| 66 | + onDrawerPan (side, args) { |
| 67 | + let ht = this.$refs.ht.nativeView; |
| 68 | + if (ht.marginTop < 0 && this.isStart) { |
| 69 | + ht.marginTop = ht.marginTop + 5; |
| 70 | + } else { |
| 71 | + if (this.isTime) { |
| 72 | + this.isTime = false; |
| 73 | + this.await(); |
| 74 | + console.log('666666') |
| 75 | + } |
| 76 | +
|
| 77 | + } |
| 78 | + console.log('xxxxx', ht.marginTop) |
| 79 | + }, |
| 80 | + onListPane (side, args) { |
| 81 | + let list = this.$refs.list.nativeView; |
| 82 | + let scrollTop = this.getScrollY(); |
| 83 | + console.log('kkk', scrollTop); |
| 84 | + if (scrollTop == 0) { |
| 85 | + this.isStart = true; |
| 86 | + } |
| 87 | + //console.log('kkkk',list.android.smoothScrollToPosition(500)); |
| 88 | + //list.scrollToIndex(500) |
| 89 | + }, |
| 90 | + getScrollY () { |
| 91 | + let mListView = this.$refs.list.nativeView.android; |
| 92 | + let c = mListView.getChildAt(0); |
| 93 | + if (c == null) { |
| 94 | + return 0; |
| 95 | + } |
| 96 | + let firstVisiblePosition = mListView.getFirstVisiblePosition(); |
| 97 | + let top = c.getTop(); |
| 98 | + return -top + firstVisiblePosition * c.getHeight(); |
| 99 | + } |
| 100 | + } |
| 101 | +}; |
| 102 | +</script> |
| 103 | + |
| 104 | +<style scoped> |
| 105 | +.first { |
| 106 | + margin-top: -60; |
| 107 | +} |
| 108 | +ActionBar { |
| 109 | + background-color: #53ba82; |
| 110 | + color: #ffffff; |
| 111 | +} |
| 112 | +.message { |
| 113 | + vertical-align: center; |
| 114 | + text-align: center; |
| 115 | + font-size: 20; |
| 116 | + color: #333333; |
| 117 | +} |
| 118 | +.icons { |
| 119 | + font-family: "icomoon"; |
| 120 | + font-size: 48; |
| 121 | +} |
| 122 | +.icon { |
| 123 | + font-family: iconfont; |
| 124 | + font-size: 48; |
| 125 | +} |
| 126 | +</style> |
0 commit comments