upgrade
This commit is contained in:
@ -37,7 +37,7 @@ div
|
||||
|
||||
<script>
|
||||
export default {
|
||||
async asyncData({ route, app, $axios }) {
|
||||
async asyncData ({ route, app, $axios }) {
|
||||
const data = await $axios.$get(`/public/article/details?id=${route.params.id}`)
|
||||
const result = data.result
|
||||
result.post_date = app.$moment(result.post_date).utc().format('lll')// 格式化时间
|
||||
@ -56,12 +56,7 @@ export default {
|
||||
tocIds: result.post_toc_ids
|
||||
}
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: `${this.Articels.post_title} - 轶哥博客`
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
mounted () {
|
||||
this.$finishLoad()
|
||||
|
||||
if (this.Articels.post_toc_show) {
|
||||
@ -107,7 +102,7 @@ export default {
|
||||
const scrollToc = () => {
|
||||
let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
|
||||
const windowWidth = window.innerWidth || document.documentElement.clientWidth
|
||||
if (windowWidth < 768) scrollTop = scrollTop * 2.7 + 175
|
||||
if (windowWidth < 768) { scrollTop = scrollTop * 2.7 + 175 }
|
||||
const tocIdsInx = findInIds(tocIdsTop, scrollTop + 130)
|
||||
if (tocIdsInx !== -1 && lastIdInx !== tocIdsInx && document.getElementsByClassName('articelRightToc')[0]) {
|
||||
const tocAList = document.getElementsByClassName('articelRightToc')[0].getElementsByTagName('a')
|
||||
@ -135,7 +130,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
decodeTitle(name) {
|
||||
decodeTitle (name) {
|
||||
try {
|
||||
return this.urldecode(name)
|
||||
} catch (err) {
|
||||
@ -143,11 +138,11 @@ export default {
|
||||
return name
|
||||
}
|
||||
},
|
||||
urldecode(encodedString) {
|
||||
urldecode (encodedString) {
|
||||
let output = encodedString
|
||||
let binVal, thisString
|
||||
const myregexp = /(%[^%]{2})/
|
||||
function utf8to16(str) {
|
||||
function utf8to16 (str) {
|
||||
let c
|
||||
let char2, char3
|
||||
|
||||
@ -189,13 +184,13 @@ export default {
|
||||
output = utf8to16(output)
|
||||
return output
|
||||
},
|
||||
articelRightTocClick() {
|
||||
articelRightTocClick () {
|
||||
const windowWidth = window.innerWidth || document.documentElement.clientWidth
|
||||
if (windowWidth < 768) {
|
||||
this.showRightToc = false
|
||||
}
|
||||
},
|
||||
isOnScreen(element) {
|
||||
isOnScreen (element) {
|
||||
const ON_SCREEN_HEIGHT = 50
|
||||
const ON_SCREEN_WIDTH = 50
|
||||
|
||||
@ -227,6 +222,11 @@ export default {
|
||||
|
||||
return bottomBoundingOnScreen && topBoundingOnScreen && rightBoundingOnScreen && leftBoundingOnScreen
|
||||
}
|
||||
},
|
||||
head () {
|
||||
return {
|
||||
title: `${this.Articels.post_title} - 轶哥博客`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user