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() {