ElemFillTable.vue 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <div class="elem-fill-table">
  3. <table class="table">
  4. <tr v-for="rowNo in data.rowCount" :key="rowNo">
  5. <td v-for="colNo in data.colCount" :key="colNo" :style="tdStyles">
  6. <div :style="tdContStyles">
  7. {{ data.content[`${rowNo}_${colNo}`] }}
  8. </div>
  9. </td>
  10. </tr>
  11. </table>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "elem-fill-table",
  17. props: {
  18. data: {
  19. type: Object,
  20. },
  21. },
  22. data() {
  23. return {};
  24. },
  25. computed: {
  26. tdStyles() {
  27. return {
  28. border: `1px ${this.data.lineStyle} #000`,
  29. };
  30. },
  31. tdContStyles() {
  32. return {
  33. padding: this.data.padding.map((item) => `${item}px`).join(" "),
  34. fontSize: this.data.fontSize,
  35. height: this.data.lineHeight + "px",
  36. };
  37. },
  38. },
  39. mounted() {},
  40. methods: {},
  41. };
  42. </script>