Authored by 沈志敏

fix bug

@@ -34,26 +34,44 @@ @@ -34,26 +34,44 @@
34 cheader 34 cheader
35 }, 35 },
36 methods: { 36 methods: {
37 - share: function() { 37 + share() {
38 yoho.goShare({ 38 yoho.goShare({
39 title: this.title || '', 39 title: this.title || '',
40 des: '我在BLK发现了一个不错的商品,快来看看吧!', 40 des: '我在BLK发现了一个不错的商品,快来看看吧!',
41 img: this.img, 41 img: this.img,
42 url: location.href 42 url: location.href
43 }); 43 });
  44 + },
  45 + toggle() {
  46 + let ghost = true;
  47 + let ghost2 = false;
  48 + let ghost3 = false;
  49 +
  50 + if (window.scrollY > 100) {
  51 + ghost = false;
  52 + ghost2 = false;
  53 + ghost3 = false;
  54 + } else if (window.scrollY > 70) {
  55 + ghost = false;
  56 + ghost3 = true;
  57 + } else if (window.scrollY > 30) {
  58 + ghost = false;
  59 + ghost2 = true;
  60 + }
  61 +
  62 + this.$refs.header.$el.classList.toggle('ghost', ghost);
  63 + this.$refs.header.$el.classList.toggle('ghost-2', ghost2);
  64 + this.$refs.header.$el.classList.toggle('ghost-3', ghost3);
44 } 65 }
45 }, 66 },
46 -  
47 created() { 67 created() {
48 - window.onscroll = () => {  
49 - let transparent = true; 68 + window.addEventListener('touchmove', () => {
  69 + this.toggle();
  70 + });
50 71
51 - if (window.scrollY > 20) {  
52 - transparent = false;  
53 - }  
54 -  
55 - this.$refs.header.$el.classList.toggle('ghost', transparent);  
56 - }; 72 + window.addEventListener('scroll', () => {
  73 + this.toggle();
  74 + });
57 } 75 }
58 }; 76 };
59 </script> 77 </script>