| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <div class="write-new-comment">
- <label>
- <input type="text" v-model="title" :placeholder="placeholder || '讨论主题'" maxlength="100">
- </label>
- <label>
- <textarea v-model="content" placeholder="在此填写详细内容"></textarea>
- </label>
- <icon-button class="send-button" theme="green" @click="handleSubmitComment" :size="44">send</icon-button>
- </div>
- </template>
- <script>
- import IconButton from '@/components/Basic/IconButton'
- export default {
- props: ['placeholder'],
- components: { IconButton },
- data () {
- return {
- title: '',
- content: ''
- }
- },
- methods: {
- handleSubmitComment () {
- if (!(this.title && this.content)) {
- this.$setInfoMessage('主题和内容均需要填写')
- return
- }
- this.$emit('comment-submit', { title: this.title, content: this.content })
- },
- resetContent () {
- this.title = ''
- this.content = ''
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '~@/style/theme.scss';
- .write-new-comment {
- position: relative;
- }
- input, textarea {
- font-weight: bold;
- box-sizing: border-box;
- font-size: 16px;
- color: #3a4a5a;
- background: white;
- border-radius: 8px;
- border: none;
- outline: none;
- width: 100%;
- height: 48px;
- line-height: 2;
- padding: 0 12px 0 12px;
- transition: .2s;
- &:hover {
- background: $input-background-color;
- }
- &::placeholder {
- color: #9aaaba;
- }
- }
- input {
- border-radius: 8px 8px 0 0;
- border: 1px solid #eaedef;
- }
- textarea {
- border-radius: 0 0 8px 8px;
- border: 1px solid #eaedef;
- border-top: none;
- min-height: 96px;
- height: 100%;
- resize: none;
- padding-bottom: 20px;
- }
- .send-button {
- position: absolute;
- bottom: -10%;
- right: 16px;
- background: white;
- &:hover {
- background: lighten($theme-green-light, 2);
- }
- }
- </style>
|