| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <template>
- <div :style="{'width': width + 'px'}" class="container" style="border-color: white">
- <el-input v-model="describe" placeholder="输入你的评论" style="margin-top: 20px" type="textarea"></el-input>
- <el-button type="primary" @click="submit" style="margin-top: 20px" round>发表<i class="el-icon-upload el-icon--right"></i></el-button>
- </div>
- </template>
- <script>
- import { submitComment } from "../api/comment.js"
- export default {
- name: "",
- data() {
- return {
- describe: "",
- colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
- }
- },
- props: {
- width: Number,
- postId: Number
- },
- methods: {
- submit() {
- if (!this.describe) {
- this.$message.warning('请填写评价')
- return
- }
- submitComment({
- userId: 0,
- content: this.describe,
- postId: this.postId
- }).then(res => {
- if (res.success === 0) {
- this.$message.success('发表成功!')
-
- }
- else {
- this.$message.error(res.message)
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|