scrollTop.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template name="scrollTop">
  2. <!-- 商品详情价格判断 -->
  3. <view>
  4. <view class="scrollTop" :style="{bottom:bottom+'rpx'}">
  5. <view class="icon top" @click="onPageScrollTop" :class="isScrollTop ? 'show' : 'none'">
  6. <text class="iconfont icon-zhiding"></text>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default{
  13. name:'scrollTop',
  14. props:{
  15. bottom:{
  16. type:Number,
  17. default:100
  18. },
  19. isScrollTop:{
  20. type:Boolean,
  21. default:false
  22. },
  23. hideContact:{
  24. type:Boolean,
  25. default:false
  26. }
  27. },
  28. data() {
  29. return{
  30. isPhone:false,
  31. telPhone:'0755-22907771',
  32. mobilePhone:'15338851365'
  33. }
  34. },
  35. created() {
  36. },
  37. methods:{
  38. onPageScrollTop(){
  39. uni.pageScrollTo({
  40. scrollTop: 0,
  41. duration: 600
  42. });
  43. },
  44. handleContact(e){
  45. console.log(e.detail.path)
  46. console.log(e.detail.query)
  47. },
  48. },
  49. }
  50. </script>
  51. <style lang="scss">
  52. .scrollTop{
  53. width: 80rpx;
  54. height: 80rpx;
  55. position: fixed;
  56. right: 20rpx;
  57. z-index: 999;
  58. .icon{
  59. width: 80rpx;
  60. height: 80rpx;
  61. border-radius: 50%;
  62. float: left;
  63. margin: 10rpx 0;
  64. line-height: 80rpx;
  65. text-align: center;
  66. .contact-btn{
  67. width: 80rpx;
  68. height: 80rpx;
  69. background-color: rgba(0,0,0,0);
  70. line-height: 80rpx;
  71. .iconfont{
  72. font-size: $font-size-44;
  73. color: #FFFFFF;
  74. }
  75. }
  76. &.top{
  77. background-color: rgba(25, 25, 25, 0.3);
  78. &.show{
  79. opacity: 1;
  80. }
  81. &.none{
  82. opacity: 0;
  83. }
  84. }
  85. .iconfont{
  86. font-size: $font-size-26;
  87. color: #FFFFFF;
  88. }
  89. }
  90. }
  91. </style>