zx-top.vue 829 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <view class="content">
  3. <image src='../../static/top.png' class='goTop' v-if='status' @click="goTop"></image>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. floorstatus: false
  11. }
  12. },
  13. props: {
  14. status: Boolean,
  15. },
  16. methods: {
  17. //回到顶部
  18. goTop: function(e) { // 一键回到顶部
  19. if (uni.pageScrollTo) {
  20. uni.pageScrollTo({
  21. scrollTop: 0
  22. })
  23. } else {
  24. uni.showModal({
  25. title: '提示',
  26. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  27. })
  28. }
  29. },
  30. }
  31. }
  32. </script>
  33. <style>
  34. /* 返回顶部 */
  35. .goTop {
  36. height: 80rpx;
  37. width: 80rpx;
  38. position: fixed;
  39. bottom: 20%;
  40. background: rgba(0, 0, 0, .3);
  41. right: 30rpx;
  42. border-radius: 50%;
  43. z-index: 999;
  44. }
  45. </style>