tools.js 641 B

12345678910111213141516171819202122232425262728293031323334353637
  1. export default {
  2. data: () => {
  3. return {
  4. pageHeight: 0,
  5. copyInfo: {
  6. form: {},
  7. info: {}
  8. }
  9. }
  10. },
  11. onReady () {
  12. this.$nextTick(() => {
  13. // 获取滚动区域的高度
  14. uni.createSelectorQuery().select('#page').boundingClientRect((rect) => {
  15. this.pageHeight = rect.height
  16. }).exec()
  17. })
  18. },
  19. methods: {
  20. toBottom () {
  21. uni.pageScrollTo({
  22. scrollTop: this.pageHeight,
  23. duration: 200 // 可根据需求设置滚动动画时长
  24. })
  25. },
  26. copy (value) {
  27. console.log(value)
  28. uni.setClipboardData({
  29. data: value,
  30. success: function () {
  31. console.log('复制成功');
  32. }
  33. });
  34. }
  35. }
  36. }