WriteNewComment.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="write-new-comment">
  3. <label>
  4. <input type="text" v-model="title" :placeholder="placeholder || '讨论主题'" maxlength="100">
  5. </label>
  6. <label>
  7. <textarea v-model="content" placeholder="在此填写详细内容"></textarea>
  8. </label>
  9. <icon-button class="send-button" theme="green" @click="handleSubmitComment" :size="44">send</icon-button>
  10. </div>
  11. </template>
  12. <script>
  13. import IconButton from '@/components/Basic/IconButton'
  14. export default {
  15. props: ['placeholder'],
  16. components: { IconButton },
  17. data () {
  18. return {
  19. title: '',
  20. content: ''
  21. }
  22. },
  23. methods: {
  24. handleSubmitComment () {
  25. if (!(this.title && this.content)) {
  26. this.$setInfoMessage('主题和内容均需要填写')
  27. return
  28. }
  29. this.$emit('comment-submit', { title: this.title, content: this.content })
  30. },
  31. resetContent () {
  32. this.title = ''
  33. this.content = ''
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. @import '~@/style/theme.scss';
  40. .write-new-comment {
  41. position: relative;
  42. }
  43. input, textarea {
  44. font-weight: bold;
  45. box-sizing: border-box;
  46. font-size: 16px;
  47. color: #3a4a5a;
  48. background: white;
  49. border-radius: 8px;
  50. border: none;
  51. outline: none;
  52. width: 100%;
  53. height: 48px;
  54. line-height: 2;
  55. padding: 0 12px 0 12px;
  56. transition: .2s;
  57. &:hover {
  58. background: $input-background-color;
  59. }
  60. &::placeholder {
  61. color: #9aaaba;
  62. }
  63. }
  64. input {
  65. border-radius: 8px 8px 0 0;
  66. border: 1px solid #eaedef;
  67. }
  68. textarea {
  69. border-radius: 0 0 8px 8px;
  70. border: 1px solid #eaedef;
  71. border-top: none;
  72. min-height: 96px;
  73. height: 100%;
  74. resize: none;
  75. padding-bottom: 20px;
  76. }
  77. .send-button {
  78. position: absolute;
  79. bottom: -10%;
  80. right: 16px;
  81. background: white;
  82. &:hover {
  83. background: lighten($theme-green-light, 2);
  84. }
  85. }
  86. </style>