FillDescribe.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <el-dialog
  3. :visible="visible"
  4. width="260px"
  5. top="38vh"
  6. :show-close="false"
  7. :close-on-click-modal="false"
  8. @close="dialogClose"
  9. >
  10. <el-input v-model="file.title" autocomplete="off" placeholder="标题" maxlength="20" :show-word-limit="true" />
  11. <el-input v-model="file.intro" type="textarea" placeholder="介绍" maxlength="200" :show-word-limit="true" />
  12. <template slot="footer">
  13. <el-button size="medium" @click="dialogClose">取消</el-button>
  14. <el-button type="primary" size="medium" @click="confirm">确定</el-button>
  15. </template>
  16. </el-dialog>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'FillDescribe',
  21. props: {
  22. visible: {
  23. type: Boolean,
  24. required: true,
  25. },
  26. fileData: {
  27. type: Object,
  28. default: () => ({}),
  29. },
  30. },
  31. data() {
  32. return {
  33. file: {
  34. title: '',
  35. intro: '',
  36. },
  37. };
  38. },
  39. watch: {
  40. fileData: {
  41. handler(val) {
  42. Object.assign(this.file, val);
  43. },
  44. deep: true,
  45. },
  46. },
  47. methods: {
  48. dialogClose() {
  49. this.$emit('update:visible', false);
  50. },
  51. confirm() {
  52. this.$emit('update:visible', false);
  53. this.$emit('fillDescribeToFile', this.file);
  54. },
  55. },
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. .el-dialog {
  60. :deep &__header {
  61. padding: 0;
  62. }
  63. :deep &__body {
  64. display: flex;
  65. flex-direction: column;
  66. row-gap: 8px;
  67. padding: 8px 8px 0;
  68. .el-textarea__inner {
  69. height: 108px;
  70. }
  71. }
  72. :deep &__footer {
  73. display: flex;
  74. padding: 8px;
  75. .el-button {
  76. flex: 1;
  77. }
  78. }
  79. }
  80. </style>