inputRow.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <script >
  2. export default {
  3. name: 'inputRow',
  4. props: {
  5. label: {
  6. type: String,
  7. default: ''
  8. },
  9. labelWidth: {
  10. type: Number,
  11. default: 0
  12. },
  13. form: {
  14. type: Object,
  15. default: () => {}
  16. },
  17. checkFormItem: {
  18. type: Function,
  19. default: () => {}
  20. },
  21. state: {
  22. type: Number,
  23. default: 0
  24. },
  25. msg: {
  26. type: String,
  27. default: ''
  28. },
  29. remark: {
  30. type: String,
  31. default: ''
  32. }
  33. },
  34. data(){
  35. return {
  36. }
  37. },
  38. methods: {
  39. }
  40. }
  41. </script>
  42. <template>
  43. <div class="w-full px-1.5 flex">
  44. <div class="w-4/12 flex items-center u px-1 justify-center"
  45. :style="`${labelWidth?`width:${labelWidth}px;`:''}`"
  46. >
  47. <span class="w-full flex items-center justify-center">
  48. {{ label }}
  49. <!-- 显示一个问号,悬浮时显示remark, 不使用 a toolTip -->
  50. <a-tooltip v-if="remark" placement="topLeft">
  51. <template slot="title">
  52. {{remark}}
  53. </template>
  54. <a-icon type="question-circle" />
  55. </a-tooltip>
  56. </span>
  57. </div>
  58. <div class="w-8/12"
  59. :style="`${labelWidth?`width:calc(100% - ${labelWidth}px);`:''}`"
  60. >
  61. <slot></slot>
  62. <div :class="`w-full ${state===0?'text-red-600':'text-green-300'}`" v-show="msg" >
  63. {{msg}}
  64. </div>
  65. <slot name="extra"></slot>
  66. </div>
  67. </div>
  68. </template>
  69. <style scoped>
  70. </style>