scrollTop.vue 1.7 KB

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