From 0db3e90da13d93e673706c44c0ce17574e9c74e5 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 10 Mar 2020 18:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9markdown=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/public/article/index.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/views/public/article/index.vue b/src/views/public/article/index.vue index 77f2122..58c89eb 100644 --- a/src/views/public/article/index.vue +++ b/src/views/public/article/index.vue @@ -64,8 +64,10 @@ }).then((res) => { this.pageTitle = res.data.name this.content = res.data.contentText - const _this = this + let path = res.data.path + let userId = res.data.userId setTimeout(function () { + // 刷新界面 回到上次滚动条的位置 if (document.cookie.match(/scrollTop=([^;]+)(;|$)/) != null) { var arr = document.cookie.match(/scrollTop=([^;]+)(;|$)/); //cookies中不为空,则读取滚动条位置 document.documentElement.scrollTop = parseInt(arr[1]); @@ -80,6 +82,21 @@ this.pageTitle = hTag.innerText } + setTimeout(function () { + let images = document.querySelector(".el-main").getElementsByTagName("img"); + console.log(images) + // let images = $('.el-main').find("img"); + // console.log(images[0].getAttr("src")) + // const oldSrc = images[i].attr("src") + // for (let i = 0; i < images.length/2; i++) { + // if(!oldSrc.startsWith("/file/public")){ + // const newPath = "/file/public/view?relativePath="+path + oldSrc +"&userId="+userId; + // console.log(newPath) + // images[i].attr("src",newPath) + // } + // } + }) + let a = $('.el-main').html().match(/|/g); if(a && a.length >0 ){ a = a.splice(a.length/2,a.length)