From 7fa3f1069737f84632b8a9d0318723378b2e8a62 Mon Sep 17 00:00:00 2001 From: "ck01060722@163.com" Date: Tue, 17 May 2022 15:22:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3url#=E5=89=8D=E9=9A=8F?= =?UTF-8?q?=E4=BE=BF=E8=BE=93=E5=85=A5=E4=BB=8D=E8=83=BD=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E9=97=AE=E9=A2=98=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/App.vue b/src/App.vue index 1f32c36..aa4d554 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,6 +27,18 @@ export default { name: 'App', components: { Navbar + }, + methods: { + goUrl () { + let firstlength = window.location.protocol.length + 3 + window.location.host.length + let errLength = window.location.href.length - (window.location.protocol.length + 3 + window.location.host.length + window.location.hash.length) + let lastLength = window.location.hash.length + let newUrl = window.location.href.substr(0, firstlength) + window.location.href.substr(firstlength + errLength, lastLength) + history.pushState('', '', newUrl) + } + }, + mounted () { + this.goUrl() } } -- Gitee