-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.vue
112 lines (102 loc) · 2.24 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<template>
<div id="app">
<VueFakeScroll ref="fake-scroll" class="fake-scroll" :scroll-width="2000" :scroll-height="2000" @update="handleUpdate">
<div class="content">
<p class="text">
scrollLeft: {{scrollLeft}}
<br />
scrollTop: {{scrollTop}}
<br />
scrollWidth: {{scrollWidth}}
<br />
scrollHeight: {{scrollHeight}}
<br />
clientWidth: {{clientWidth}}
<br />
clientHeight: {{clientHeight}}
<br />
scrollLeftMax: {{scrollLeftMax}}
<br />
scrollTopMax: {{scrollTopMax}}
<br />
scrollLeftInterval: {{scrollLeftInterval}}
<br />
scrollTopInterval: {{scrollTopInterval}}
<br />
</p>
</div>
</VueFakeScroll>
</div>
</template>
<script>
import VueFakeScroll from './components/VueFakeScroll'
export default {
name: 'app',
components: {
VueFakeScroll,
},
data() {
return {
scrollLeft: 0,
scrollTop: 0,
scrollWidth: 0,
scrollHeight: 0,
clientWidth: 0,
clientHeight: 0,
scrollLeftMax: 0,
scrollTopMax: 0,
scrollLeftInterval: 0,
scrollTopInterval: 0,
}
},
methods: {
handleUpdate(e) {
this.scrollLeft = e.scrollLeft
this.scrollTop = e.scrollTop
this.scrollWidth = e.scrollWidth
this.scrollHeight = e.scrollHeight
this.clientWidth = e.clientWidth
this.clientHeight = e.clientHeight
this.scrollLeftMax = e.scrollLeftMax
this.scrollTopMax = e.scrollTopMax
this.scrollLeftInterval = e.scrollLeftInterval
this.scrollTopInterval = e.scrollTopInterval
}
}
}
</script>
<style>
html, body, #app {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
</style>
<style scoped>
#app {
position: relative;
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
}
.fake-scroll {
width: 100%;
height: 100%;
}
.content {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.text {
width: 200px;
white-space: nowrap;
}
.long-text {
padding: 3em;
}
</style>