File tree 4 files changed +25
-4
lines changed 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 1
- #### navbar 注意事项
1
+ #### test.vue( navbar) 注意事项
2
2
1 安装swiper3 npm i vue-awesome-swiper@2.6.7 -S
3
3
2 每一个slide的width,强制auto
4
- TODO 数据异步获取 切换动画效果 上拉加载
4
+ TODO 数据异步获取 切换动画效果 上拉加载
5
+ 监控scroll事件
Original file line number Diff line number Diff line change @@ -12,3 +12,5 @@ npm i node-sass sass-loader http-proxy-middleware -D
12
12
note: https://github.com/KokoTa/Vue2-transition 路由切换动画
13
13
d5c6d2bf873068e96234181d1afc507fce71a19a
14
14
*** 引入store 改写了请求方式 完成首页和登录页
15
+ 6f37a2e017ae903142b25db9a9e67b06e5138412
16
+ *** 增加一个scroll事件的监听
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div >
2
+ <div style = " height : 2000 px " >
3
3
<swiper :options =" swiperOption" :not-next-tick =" swiperOption.notNextTick" ref =" swiper1" >
4
4
<!-- slides -->
5
5
<swiper-slide
14
14
<!-- slides -->
15
15
<swiper-slide >I'm Slide {{floorNavData.activeIndex}}</swiper-slide >
16
16
</swiper >
17
+ <div class =" lorem" :style =" {opacity: opacityValue}" >Lorem ipsum tam similique dolor veniam iure eveniet non vel ut eum iusto sapiente est.</div >
17
18
</div >
18
19
</template >
19
20
<script >
@@ -44,7 +45,8 @@ export default {
44
45
// setCurrentSlide($(".swiper1 .swiper-slide").eq(n), n);
45
46
// swiper1.slideTo(n, 500, false);
46
47
}
47
- }
48
+ },
49
+ opacityValue: 0.9
48
50
}
49
51
},
50
52
computed: {
@@ -55,6 +57,9 @@ export default {
55
57
return this .$refs .swiper2 .swiper
56
58
}
57
59
},
60
+ created () {
61
+ window .addEventListener (' scroll' , this .getOpacityValue )
62
+ },
58
63
mounted () {
59
64
// current swiper instance
60
65
// 然后你就可以使用当前上下文内的swiper对象去做你想做的事了
@@ -65,6 +70,10 @@ export default {
65
70
methods: {
66
71
onFloorNav (index ) {
67
72
this .floorNavData .activeIndex = index
73
+ },
74
+ getOpacityValue () {
75
+ let b = document .body .scrollTop / 550 || document .documentElement .scrollTop / 550
76
+ this .opacityValue = b > 0.9 ? 0.9 : b
68
77
}
69
78
}
70
79
}
@@ -76,4 +85,7 @@ export default {
76
85
.is-active {
77
86
border-bottom : 1px solid red ;
78
87
}
88
+ .lorem {
89
+ background : #d9241c ;
90
+ }
79
91
</style >
Original file line number Diff line number Diff line change 3
3
<head-top signin-up =' home' >
4
4
<span slot =' logo' class =" head_logo" @click =" reload" >ele.me</span >
5
5
</head-top >
6
+ <button style =" margin-top :100px " @click =" goTest" >去测试页面</button >
6
7
</div >
7
8
</template >
8
9
<script >
@@ -37,6 +38,7 @@ export default {
37
38
sortgroupcity () {
38
39
let sortobj = {}
39
40
for (let i = 65 ; i <= 90 ; i++ ) {
41
+ // 静态 String.fromCharCode() 方法返回使用指定的Unicode值序列创建的字符串。
40
42
if (this .groupcity [String .fromCharCode (i)]) {
41
43
sortobj[String .fromCharCode (i)] = this .groupcity [String .fromCharCode (i)]
42
44
}
@@ -52,7 +54,11 @@ export default {
52
54
},
53
55
// 点击图标刷新页面
54
56
reload () {
57
+ // window.location 只读属性,返回一个 Location对象Location.reload() 方法用来刷新当前页面。该方法只有一个参数,当值为 true 时,将强制浏览器从服务器加载页面资源,当值为 false 或者未传参时,浏览器则可能从缓存中读取页面
55
58
window .location .reload ()
59
+ },
60
+ goTest () {
61
+ this .$router .push (' ./test' )
56
62
}
57
63
}
58
64
}
You can’t perform that action at this time.
0 commit comments