proxyBanner.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="proxy-banner" :class="{'fixed':isFixed}">
  3. <div class="banner-inner clearfix">
  4. <button class="apply">申请代理</button>
  5. <p class="hot-line">热线电话:4001-566-899</p>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: "proxyBanner",
  12. data(){
  13. return{
  14. isFixed:false,
  15. }
  16. },
  17. mounted(){
  18. window.addEventListener('scroll',this.scrollListener)
  19. },
  20. methods:{
  21. scrollListener(e){
  22. this.isFixed=window.pageYOffset>800;
  23. // console.log(window.pageYOffset);
  24. }
  25. }
  26. }
  27. </script>
  28. <style scoped lang="less">
  29. @import "../assets/less/_variable.less";
  30. .proxy-banner{
  31. position: absolute;
  32. top:800px;
  33. width: 100%;
  34. height: 100px;
  35. background-color: rgba(0, 0, 0, .5);
  36. display: flex;
  37. justify-content: space-between;
  38. &.fixed{
  39. position: fixed;
  40. z-index: 9;
  41. top: auto;
  42. bottom:0;
  43. }
  44. & .banner-inner{
  45. /*float: left;*/
  46. margin: 0 auto;
  47. & .apply{
  48. float: left;
  49. font-size: 18px;
  50. color: #ffffff;
  51. border: none;
  52. width: 140px;
  53. height: 40px;
  54. margin-top: 30px;
  55. background-color: @primaryBlue;
  56. border-radius: 20px;
  57. }
  58. & .hot-line{
  59. float: left;
  60. margin-left: 120px;
  61. line-height: 100px;
  62. font-size: 25px;
  63. color: #ffffff;
  64. }
  65. }
  66. }
  67. </style>