scrollTop.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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">
  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. },
  23. data() {
  24. return{
  25. isPhone:false,
  26. telPhone:'0755-22907771',
  27. mobilePhone:'15338851365'
  28. }
  29. },
  30. created() {
  31. },
  32. methods:{
  33. onPageScrollTop(){
  34. uni.pageScrollTo({
  35. scrollTop: 0,
  36. duration: 600
  37. });
  38. },
  39. handleContact(e){
  40. console.log(e.detail.path)
  41. console.log(e.detail.query)
  42. },
  43. },
  44. }
  45. </script>
  46. <style lang="scss">
  47. .scrollTop{
  48. width: 80rpx;
  49. height: 200rpx;
  50. position: fixed;
  51. right: 20rpx;
  52. bottom: 20%;
  53. .icon{
  54. width: 80rpx;
  55. height: 80rpx;
  56. border-radius: 50%;
  57. float: left;
  58. margin: 10rpx 0;
  59. line-height: 80rpx;
  60. text-align: center;
  61. .contact-btn{
  62. width: 80rpx;
  63. height: 80rpx;
  64. background-color: rgba(0,0,0,0);
  65. line-height: 80rpx;
  66. .iconfont{
  67. font-size: $font-size-44;
  68. color: #FFFFFF;
  69. }
  70. }
  71. &.msg{
  72. background-image: linear-gradient(0deg, #f28e31 0%, #e15616 100%);
  73. }
  74. &.top{
  75. background-color: rgba(0,0,0,0.4);
  76. }
  77. .iconfont{
  78. font-size: $font-size-44;
  79. color: #FFFFFF;
  80. }
  81. }
  82. }
  83. </style>