new_file.vue 880 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div>
  3. <div v-for="row in 10" class="row" :key="row">
  4. <div
  5. v-for="col in 10"
  6. class="col"
  7. :key="col"
  8. :class="{ marked: isMarked(row, col) }">
  9. {{ row }} - {{ col }}
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. markedPoints: [
  19. { row: 2, col: 3 },
  20. { row: 5, col: 7 },
  21. // 添加其他标记点的坐标
  22. ],
  23. };
  24. },
  25. methods: {
  26. isMarked(row, col) {
  27. return this.markedPoints.some(
  28. (point) => point.row === row && point.col === col
  29. );
  30. },
  31. },
  32. };
  33. </script>
  34. <style>
  35. /* 添加样式来区分标记点 */
  36. .marked {
  37. background-color: red;
  38. }
  39. .row {
  40. display: flex;
  41. }
  42. .col {
  43. width: 30px;
  44. height: 30px;
  45. border: 1px solid #000;
  46. display: flex;
  47. justify-content: center;
  48. align-items: center;
  49. }
  50. </style>