11<template >
22 <Page class =" page" loaded =" pageLoaded" ref =" page" >
33 <ActionBarSecond :title =" '下拉刷新'" ></ActionBarSecond >
4- <FlexboxLayout
5- flexDirection =" column"
6- backgroundColor =" #3c495e"
7- @pan =" onDrawerPan(side, $event)"
8- >
9- <!-- <Label class="first" text="first" height="70" backgroundColor="#43b883" ref="ht" flexShrink="0" />
10- <Label text="second" height="70" backgroundColor="#1c6b48" flexShrink="0" />-->
11- <!-- <Label text="third" height="100%" backgroundColor="#289062" /> -->
12- <ListView for =" item in listArr" ref =" list" @pan =" onListPane(side,$event)" >
13- <v-template >
14- <Label :text =" item" class =" icon" />
15- </v-template >
16- </ListView >
17- </FlexboxLayout >
4+
185 <GridLayout colums =" *" rows =" *" >
19- <Label class =" message" :text =" msg" col =" 0" row =" 0" />
206 <PullToRefresh @refresh =" refreshList" >
21- <ListView for =" item in listArr " >
7+ <ListView for =" item in listOfItems " @itemTap = " onItemTap " >
228 <v-template >
23- <Label :text =" item" class =" icon" />
9+ <!-- Shows the list item label in the default color and style. -->
10+ <Label class =" message" :text =" msg" col =" 0" row =" 0" />
11+ <label :text =" item.text" />
2412 </v-template >
2513 </ListView >
2614 </PullToRefresh >
@@ -37,81 +25,30 @@ export default {
3725 data () {
3826 return {
3927 msg: ' Hello World! ' ,
40- listArr: [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 ],
41- num: 0 ,
42- isStart: false ,
43- isTime: true
28+ listOfItems: [{ text: ' 下拉刷新' }, { text: ' 下拉刷新' }, { text: ' 下拉刷新' }]
4429 };
4530 },
4631 mounted () {
47- this . pageLoaded ( );
32+ console . log ( ' 下拉刷新 ' );
4833 },
4934 methods: {
50- pageLoaded : function (args ) {},
5135 await : function () {
52- console .log (' 丁丁事' );
5336 let that = this ;
5437 setTimeout (function () {
5538 console .log (' 对不起, 要你久候' );
5639 that .isTime = true ;
5740 console .log (' 定时了' );
5841 }, 3000 );
5942 },
60- // refreshList (args) {
61- // var pullRefresh = args.object;
62- // let that = this;
63- // setTimeout(function () {
64- // pullRefresh.refreshing = false;
65- // that.isTime = true;
66- // console.log('定时了');
67- // }, 1000);
68- // },
69- onButton : function () {},
70- onDrawerPan (side , args ) {
71- let ht = this .$refs .ht .nativeView ;
72- if (ht .marginTop < 0 && this .isStart ) {
73- ht .marginTop = ht .marginTop + 5 ;
74- } else {
75- if (this .isTime ) {
76- this .isTime = false ;
77- this .await ();
78- }
79- }
80- },
81- onListPane (side , args ) {
82- let list = this .$refs .list .nativeView ;
83- let scrollTop = this .getScrollY ();
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 ();
43+ refreshList (args ) {
44+ var pullRefresh = args .object ;
45+ setTimeout (function () {
46+ pullRefresh .refreshing = false ;
47+ }, 1000 );
9948 }
10049 }
10150};
10251 </script >
10352
10453<style scoped lang="scss">
105- .first {
106- margin-top : -60 ;
107- }
108-
109- .icons {
110- font-family : ' icomoon' ;
111- font-size : 48 ;
112- }
113- .icon {
114- font-family : iconfont;
115- font-size : 48 ;
116- }
11754 </style >
0 commit comments