VciCell.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div
  3. :class="cls"
  4. :style="syl"
  5. class="VciCell vci-flex"
  6. >
  7. <slot v-bind="{ value, item }">
  8. <span
  9. :title="value"
  10. class="vci-to-e"
  11. >
  12. {{ value }}
  13. </span>
  14. </slot>
  15. </div>
  16. </template>
  17. <script>
  18. // power by visual-ceiling, at 2024/9/29 15:24
  19. import { toVh, toVw } from "../../../../other/adapt";
  20. import { isEmpty } from "@vci/helper/src/other";
  21. export default {
  22. name: "VciCell",
  23. inheritAttrs: false,
  24. props: {
  25. value: {
  26. type: [String, Number],
  27. default: "-"
  28. },
  29. item: {
  30. type: Object,
  31. default: null
  32. },
  33. width: {
  34. type: Number,
  35. default: null
  36. },
  37. height: {
  38. type: Number,
  39. default: null
  40. },
  41. justifyContent: {
  42. type: String,
  43. default: "center"
  44. },
  45. alignItems: {
  46. type: String,
  47. default: "center"
  48. },
  49. isOrderNumber: {
  50. type: Boolean,
  51. default: false
  52. },
  53. isHeader: {
  54. type: Boolean,
  55. default: false
  56. },
  57. isLastColumn: {
  58. type: Boolean,
  59. default: false
  60. }
  61. },
  62. data() {
  63. return {};
  64. },
  65. computed: {
  66. syl() {
  67. return {
  68. width: isEmpty(this.width) ? "" : toVw(this.width),
  69. minHeight: isEmpty(this.height) ? "" : toVh(this.height),
  70. justifyContent: this.justifyContent,
  71. alignItems: this.alignItems
  72. };
  73. },
  74. cls() {
  75. return [
  76. isEmpty(this.width) ? "vci-flex-1-0" : "vci-flex-0-0",
  77. {
  78. "vc-last-column": this.isLastColumn
  79. }
  80. ];
  81. }
  82. }
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .VciCell {
  87. }
  88. </style>