Showing
2 changed files
with
15 additions
and
7 deletions
1 | <template> | 1 | <template> |
2 | - <cheader title="商品详情" class="top-nav"> | 2 | + <cheader title="商品详情" class="product-header ghost" v-ref:header> |
3 | <i class="icon icon-share" slot="right" @click="share()"></i> | 3 | <i class="icon icon-share" slot="right" @click="share()"></i> |
4 | </cheader> | 4 | </cheader> |
5 | </template> | 5 | </template> |
6 | <style> | 6 | <style> |
7 | - .top-nav { | ||
8 | - .blk-header { | ||
9 | - background-color: transparent; | ||
10 | - border-bottom: 0; | ||
11 | - } | ||
12 | - | 7 | + .product-header { |
13 | .blk-header-gap { | 8 | .blk-header-gap { |
14 | display: none; | 9 | display: none; |
15 | } | 10 | } |
@@ -41,6 +36,18 @@ | @@ -41,6 +36,18 @@ | ||
41 | url: location.href | 36 | url: location.href |
42 | }); | 37 | }); |
43 | } | 38 | } |
39 | + }, | ||
40 | + | ||
41 | + created() { | ||
42 | + window.onscroll = () => { | ||
43 | + let transparent = true; | ||
44 | + | ||
45 | + if (window.scrollY > 20 ) { | ||
46 | + transparent = false; | ||
47 | + } | ||
48 | + | ||
49 | + this.$refs.header.$el.classList.toggle('ghost', transparent); | ||
50 | + } | ||
44 | } | 51 | } |
45 | }; | 52 | }; |
46 | </script> | 53 | </script> |
-
Please register or login to post a comment