Skip to content

Commit ceaf87c

Browse files
committed
debug
1 parent 9019b52 commit ceaf87c

File tree

2 files changed

+133
-2
lines changed

2 files changed

+133
-2
lines changed

app/components/example/Main.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<Button class="btn btn-primary m-t-20" text="自定义弹出框" @tap="pop" />
2525
<Button class="btn btn-primary m-t-20" text="animateCSS" @tap="animate" />
2626
<Button class="btn btn-primary m-t-20" text="下拉刷新" @tap="refresh" />
27+
<Button class="btn btn-primary m-t-20" text="下拉刷新❤新" @tap="refreshNew" />
2728
</StackLayout>
2829

2930
<!-- </GridLayout> -->
@@ -48,6 +49,7 @@ import Dialog from "./Dialog/dialog";
4849
import Pop from "./pop";
4950
import Animate from "./animate";
5051
import Refresh from "./refresh";
52+
import RefreshNew from "./refreshNew";
5153
5254
export default {
5355
data () {
@@ -57,6 +59,9 @@ export default {
5759
},
5860
mounted () { },
5961
methods: {
62+
refreshNew: function () {
63+
this.$navigateTo(RefreshNew);
64+
},
6065
onDrawer: function () {
6166
this.$navigateTo(Drawer);
6267
},
@@ -137,10 +142,10 @@ export default {
137142
pop () {
138143
this.$navigateTo(Pop);
139144
},
140-
animate(){
145+
animate () {
141146
this.$navigateTo(Animate);
142147
},
143-
refresh(){
148+
refresh () {
144149
this.$navigateTo(Refresh);
145150
}
146151
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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

Comments
 (0)