RankTable.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="rank-table">
  3. <div class="rank-table-head">最有价值的关键词排名</div>
  4. <el-table :data="tableData">
  5. <el-table-column prop="keyword" align="center" label="关键词"> </el-table-column>
  6. <el-table-column prop="searchVolume" align="center" label="搜索量">
  7. <template #default="scope">
  8. {{ parseNumber(scope.row.searchVolume) }}
  9. </template>
  10. </el-table-column>
  11. <el-table-column prop="monthly" align="center" label="SEO点击次数(变化)">
  12. <template #default="scope">
  13. <span v-if="scope.row.monthly > 0" style="color: #036eb8">{{
  14. '+ ' + parseNumber(scope.row.monthly)
  15. }}</span>
  16. <span v-else style="color: red">{{ '- ' + parseNumber(scope.row.monthly) }}</span>
  17. {{ scope }}
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="dp" align="center" label="DP(关键词难度)"> </el-table-column>
  21. <el-table-column prop="cpc" align="center" label="CPC(每次点击费用)">
  22. <template #default="scope">
  23. {{ '$ ' + scope.row.cpc }}
  24. </template>
  25. </el-table-column>
  26. <!-- <el-table-column prop="searchVolume" align="center" label="桌面搜索"> </el-table-column> -->
  27. </el-table>
  28. </div>
  29. </template>
  30. <script lang="ts" setup>
  31. import { ref, computed } from 'vue';
  32. import { useMainStore } from '@/store';
  33. const props = defineProps<{
  34. tableData: any[];
  35. }>();
  36. const mainStore = useMainStore();
  37. const expanded = computed(() => mainStore.getExpanded);
  38. const tableData = expanded.value ? props.tableData : props.tableData.slice(0, 10);
  39. const parseNumber = (num: number) => {
  40. if (num >= 1000) {
  41. return (num / 1000).toFixed(1) + 'K';
  42. }
  43. return num;
  44. };
  45. // const tableData = ref([
  46. // {
  47. // searchVolume: 5400,
  48. // cpc: 0.16,
  49. // monthly: 50,
  50. // keyword: 'popmart.com',
  51. // quarterly: 50,
  52. // dp: 92,
  53. // yearly: 10471
  54. // },
  55. // {
  56. // searchVolume: 70,
  57. // cpc: 0.96,
  58. // monthly: 27,
  59. // keyword: 'pop art usa',
  60. // quarterly: 27,
  61. // dp: 6,
  62. // yearly: 600
  63. // }
  64. // ]);
  65. </script>
  66. <style lang="scss" scoped>
  67. .rank-table {
  68. width: 100%;
  69. min-height: 300px;
  70. &-head {
  71. height: 66px;
  72. padding-left: 30px;
  73. font-weight: bold;
  74. font-size: 20px;
  75. color: #282e30;
  76. box-sizing: border-box;
  77. }
  78. :deep(.el-table) {
  79. width: 100%;
  80. height: 317px;
  81. .el-table__header {
  82. height: 52px;
  83. .el-table__cell {
  84. background: rgba(3, 110, 184, 0.1) !important;
  85. font-weight: bold;
  86. font-size: 16px;
  87. color: #282e30;
  88. }
  89. }
  90. .el-table__row {
  91. height: 52px;
  92. font-weight: bold;
  93. font-size: 14px;
  94. color: #282e30;
  95. }
  96. }
  97. :deep(.el-table__cell) {
  98. img {
  99. width: 22px;
  100. height: 22px;
  101. position: relative;
  102. top: 5px;
  103. }
  104. }
  105. }
  106. </style>