Skip to content

Commit

Permalink
Refactor article-detail and editor-form components
Browse files Browse the repository at this point in the history
  • Loading branch information
luoyunchong committed Feb 29, 2024
1 parent ccce534 commit 6e568fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/view/article/article-detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,10 @@ export default {
this.model.is_liked = is_liked
},
collectChange({ is_collect }) {
//收藏弹框
if (is_collect == true) {
this.$refs['articleCollection'].show(this.model.id);
return;
}
//取消收藏回调
this.model.is_collect = is_collect
this.model.collect_quantity -= 1
},
Expand All @@ -251,7 +249,7 @@ export default {
if (this.model.word_number == 0) {
this.model.word_number = this.model.content.length
this.model.reading_time = Number(this.model.word_number / 500).toFixed(0)
debugger
if (this.model.reading_time == 0) {
this.model.reading_time = 1
}
Expand Down Expand Up @@ -411,6 +409,7 @@ export default {
cdn:'https://images.igeekfan.cn/js/vditor',
lazyLoadImage: 'https://images.igeekfan.cn/js/vditor/dist/images/img-loading.svg',
})
Vditor.mediaRender()
},
async getQueryArticles() {
this.latestLoading = true
Expand Down
5 changes: 4 additions & 1 deletion src/view/article/editor-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
hint: {
},
mode: 'sv', //ir 即时渲染,sv 分屏预览 wysiwyg 所见即所得
cdn:'https://images.igeekfan.cn/js/vditor',
cdn: 'https://images.igeekfan.cn/js/vditor',
preview: {
delay: 100,
show: true,
Expand Down Expand Up @@ -117,8 +117,11 @@ export default {
if (res.length > 0) {
var imgMdStr = ``
res.forEach((re, i) => {
console.log(files)
if (files[i].type == 'video/webm') {
imgMdStr = `<audio controls="controls" src="${re.url}"></audio>`
} else if (files[i].type.indexOf('video') != -1) {
imgMdStr = `[${files[i].name}](${re.url})`
} else {
imgMdStr = `![${files[i].name}](${re.url})`
}
Expand Down

0 comments on commit 6e568fa

Please sign in to comment.