提交 16aa3abe authored 作者: lihuihui's avatar lihuihui

课程讨论组件修改

上级 523bbbb5
......@@ -26,7 +26,7 @@
<template v-if="commentVisible">
<!-- 评论列表 -->
<template v-for="item in data.comments">
<reply-item :data="item" :dataId="data.id" :key="item.id"></reply-item>
<reply-item v-on="$listeners" :data="item" :dataId="data.id" :key="item.id"></reply-item>
</template>
</template>
</div>
......@@ -56,7 +56,7 @@ export default {
deleteAnswer (id) {
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
api.deleteAnswer(id).then(json => {
this.$parent.updateList()
this.$emit('updateList')
this.$message({ type: 'success', message: this.$t('pages.learn.discussDetail.deleteSuccess') })
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
}
......
......@@ -28,7 +28,7 @@ export default {
deleteComment (id) {
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
api.deleteComment(id).then(json => {
this.$parent.updateList()
this.$emit('updateList')
this.$message({ type: 'success', message: this.$t('pages.learn.discussDetail.deleteSuccess') })
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
}
......
......@@ -9,7 +9,7 @@
@click="deleteComment(data.id)"
>{{ $t('pages.learn.discussDetail.delete') }}</div>
</template>
<div class="right-txt" @click="reply({answer_id: dataId, to: data.observer.nickname})">{{ $t('pages.learn.discussDetail.reply') }}</div>
<div class="right-txt" @click="$emit('reply', {answer_id: dataId, to: data.observer.nickname})">{{ $t('pages.learn.discussDetail.reply') }}</div>
</div>
<div class="text" v-html="data.comments"></div>
</div>
......@@ -24,14 +24,13 @@ export default {
data() {
return {}
},
mounted() {
},
methods: {
reply (param) {
this.$parent.$parent.replyComposeParam(param)
},
deleteComment (id) {
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
api.deleteComment(id).then(json => {
this.$parent.$parent.updateList()
this.$emit('updateList')
this.$message({ type: 'success', message: this.$t('pages.learn.discussDetail.deleteSuccess') })
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
}
......
......@@ -15,7 +15,7 @@
</div>
<div v-show='commentVisible'>
<template v-for="item in detail.comments">
<reply-item :data="item" :key="item.id" :dataId="detail.id" @reply="replyComposeParam"></reply-item>
<reply-item :data="item" :key="item.id" :dataId="detail.id" @reply="replyComposeParam" @updateList="updateList"></reply-item>
</template>
</div>
</div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论