scrollTop.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template name="scrollTop">
  2. <!-- 商品详情价格判断 -->
  3. <view>
  4. <view class="scrollTop" :style="{bottom:bottom+'rpx'}" :class="isScrollTop ? 'show' : 'none'">
  5. <view class="icon top" @click="onPageScrollTop">
  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. &.show{
  59. display: block;
  60. }
  61. &.none{
  62. display: none;
  63. }
  64. .icon{
  65. width: 80rpx;
  66. height: 80rpx;
  67. border-radius: 50%;
  68. float: left;
  69. margin: 10rpx 0;
  70. line-height: 80rpx;
  71. text-align: center;
  72. .contact-btn{
  73. width: 80rpx;
  74. height: 80rpx;
  75. background-color: rgba(0,0,0,0);
  76. line-height: 80rpx;
  77. .iconfont{
  78. font-size: $font-size-44;
  79. color: #FFFFFF;
  80. }
  81. }
  82. &.top{
  83. background-color: rgba(25, 25, 25, 0.3);
  84. }
  85. .iconfont{
  86. font-size: $font-size-26;
  87. color: #FFFFFF;
  88. }
  89. }
  90. }
  91. </style>