From 688a7a10b3a773e291a1889b3d80adf29204dfad Mon Sep 17 00:00:00 2001 From: Double-_-Z <2492419643@qq.com> Date: Thu, 17 Jul 2025 00:31:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E8=AF=A6=E6=83=85=E9=A1=B5=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=A1=86=E6=9E=B6wangedit=E5=B0=81=E8=A3=85=E7=BB=84=E4=BB=B6b?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/WangEditor/index.vue | 6 +++++- src/views/platform/article/content.vue | 25 ++++++++++++++++--------- src/views/platform/article/index.vue | 4 ++-- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/components/WangEditor/index.vue b/src/components/WangEditor/index.vue index 99b579f..a5aa7b3 100644 --- a/src/components/WangEditor/index.vue +++ b/src/components/WangEditor/index.vue @@ -84,7 +84,7 @@ export default { }}, editMode: 'default', editor: null, - editValue: null, + editValue: this.value, isFull: false, } }, @@ -96,6 +96,9 @@ export default { ]) }, watch: { + value(newVal, oldVal){ + this.editValue = newVal; + }, editValue(newVal, oldVal) { this.$emit('input', newVal) }, @@ -105,6 +108,7 @@ export default { methods: { onCreated(editor) { this.editor = Object.seal(editor) + if(!this.disableShowFullscreen) editor.fullScreen(); this.editValue = this.value }, // 全屏 diff --git a/src/views/platform/article/content.vue b/src/views/platform/article/content.vue index 692be42..6dd0af6 100644 --- a/src/views/platform/article/content.vue +++ b/src/views/platform/article/content.vue @@ -1,6 +1,6 @@ @@ -12,25 +12,32 @@ export default { components: {WangEditor}, data() { return { - text: '暂无文章内容', + textDetail: ' ', loading: false } }, - mounted(){ + created(){ const { id } = this.$route.query; if(id) this.getArticleContentById(id); }, methods:{ - async getArticleContentById(id){ - var texts = '暂无文章内容'; - await text(id).then(res => { + getArticleContentById(id){ + try { + this.loading = true; + text(id).then(res => { if(res){ - texts = res.text; + this.textDetail = res.text; }else{ - this.$message.error('文章内容获取失败!'); + this.textDetail = '暂无文章内容!'; + this.$message.error('文章内容获取失败!'); } }) - this.text = texts; + } catch (error) { + this.textDetail = '暂无文章内容!'; + this.$message.error('文章内容获取失败!'); + } finally { + this.loading = false; + } } } } diff --git a/src/views/platform/article/index.vue b/src/views/platform/article/index.vue index 605c678..16e3957 100644 --- a/src/views/platform/article/index.vue +++ b/src/views/platform/article/index.vue @@ -94,7 +94,7 @@ export default { copyLink(row){ if(row.id == null||row.id == ''){ this.$message.warning('链接为空');return;} var aux = document.createElement("input"); - aux.setAttribute("value", `${process.env.VUE_APP_BASE_PATH}/#/article/content?id=${row.id}`); + aux.setAttribute("value", `${process.env.VUE_APP_BASE_PATH}/#/article/content?id=${row.textid}`); document.body.appendChild(aux); aux.select(); document.execCommand("copy"); @@ -125,7 +125,7 @@ export default { }, // 预览 toPreview(row) { - window.open(`${process.env.VUE_APP_BASE_PATH}/#/article/content?id=${row.id}`); + window.open(`${process.env.VUE_APP_BASE_PATH}/#/article/content?id=${row.textid}`); }, // 添加文章 toAddArticle() {