博客评论后重加载评论

This commit is contained in:
2024-09-01 15:47:10 +08:00
parent d3106a6576
commit 0d33e18a88
3 changed files with 16 additions and 5 deletions

View File

@@ -1,12 +1,13 @@
<script setup>
import { Star, Edit, StarFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus';
import { ref, onMounted, onUnmounted } from 'vue';
import { ref, onMounted, onUnmounted, defineEmits } from 'vue';
import { useRoute } from 'vue-router';
import { request } from '@/lib/request';
import RotationVerification from '../Common/RotationVerification.vue';
const route = useRoute()
const bloguuid = route.params.uuid;
const emit = defineEmits(['comment-success'])
const inputComment = ref('')
let inputCommentName = '';
const toolBarVisible = ref(true);
@@ -71,6 +72,7 @@ const submitComment = async () => {
name: inputCommentName.trim() == '' ? '匿名' : inputCommentName.trim()
})
if (commentRes.code == 0) {
emit('comment-success');
return ElMessage.success('评论成功~');
} else {
throw new Error(commentRes.message);