pageItem.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view
  3. class="pageItem"
  4. @click.stop="showMenu"
  5. >
  6. <view class="content">
  7. <view>
  8. <text class="text-xs">页面路由:{{ item.route }}</text>
  9. </view>
  10. <view>
  11. <text class="text-xs">停留时长:{{ item.timeCount }}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: {
  19. /**
  20. * logs单行数据
  21. */
  22. item: {
  23. type: Object,
  24. default() {
  25. return {
  26. route: "",
  27. timeCount: "",
  28. };
  29. },
  30. },
  31. },
  32. methods: {
  33. /**
  34. * 展示菜单
  35. */
  36. showMenu() {
  37. let that = this;
  38. let r = String(that.item.route).substring(0, 10) + "...";
  39. let menu = [
  40. {
  41. text: `复制路径(${r})`,
  42. click() {
  43. uni.setClipboardData({
  44. data: that.item.route,
  45. });
  46. },
  47. },
  48. {
  49. text: `复制时间(${that.item.timeCount})`,
  50. click() {
  51. uni.setClipboardData({
  52. data: that.item.timeCount,
  53. });
  54. },
  55. },
  56. {
  57. text: `跳转至此页面`,
  58. click() {
  59. uni.$emit("devTools_showRouteDialog", that.item.route);
  60. },
  61. },
  62. ];
  63. uni.showActionSheet({
  64. itemList: menu.map((x) => x.text),
  65. success({ tapIndex }) {
  66. menu[tapIndex].click();
  67. },
  68. });
  69. },
  70. },
  71. };
  72. </script>
  73. <style lang="scss" scoped>
  74. .pageItem:active {
  75. background-color: rgba(0, 0, 0, 0.03);
  76. }
  77. .pageItem {
  78. display: flex;
  79. flex-direction: row;
  80. align-items: flex-start;
  81. justify-content: space-between;
  82. width: 750rpx;
  83. padding: 10rpx 20rpx;
  84. border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  85. .content {
  86. width: 610rpx;
  87. display: flex;
  88. flex-direction: column;
  89. .context {
  90. font-size: 20rpx;
  91. color: #333;
  92. line-height: 24rpx;
  93. }
  94. }
  95. }
  96. .text-xs {
  97. font-size: 20rpx;
  98. }
  99. </style>