This commit is contained in:
2019-12-13 11:46:15 +08:00
parent eaf48b86c3
commit 703f411ee7
17 changed files with 2662 additions and 2030 deletions

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData({ app, params, $axios }) {
async asyncData ({ app, params, $axios }) {
let Info = null
let Articels = []
const nowPage = params.page ? parseInt(params.page) : 1
@ -80,12 +80,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData({ app, params, $axios }) {
async asyncData ({ app, params, $axios }) {
let Info = null
let Articels = []
const nowPage = params.page ? parseInt(params.page) : 1
@ -80,12 +80,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData(inject) {
async asyncData (inject) {
const { app, params, $axios } = inject
let Info = null
let Articels = []
@ -81,12 +81,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData({ app, params, $axios }) {
async asyncData ({ app, params, $axios }) {
let Info = null
let Articels = []
const nowPage = params.page ? parseInt(params.page) : 1
@ -80,12 +80,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {

View File

@ -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>

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData({ app, params, query, $axios }) {
async asyncData ({ app, params, query, $axios }) {
let Info = null
let Articels = []
const nowPage = params.page ? parseInt(params.page) : 1
@ -80,12 +80,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData({ app, params, $axios }) {
async asyncData ({ app, params, $axios }) {
let Info = null
let Articels = []
const nowPage = params.page ? parseInt(params.page) : 1
@ -80,12 +80,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {

View File

@ -39,7 +39,7 @@
<script>
export default {
async asyncData({ app, params, $axios }) {
async asyncData ({ app, params, $axios }) {
let Info = null
let Articels = []
const nowPage = params.page ? parseInt(params.page) : 1
@ -80,12 +80,12 @@ export default {
nowPath: params.terms ? '/' + params.terms : ''
}
},
mounted() {
mounted () {
this.$finishLoad()
this.analyseImages()
},
methods: {
async analyseImages() { // 图片大小分析及处理
async analyseImages () { // 图片大小分析及处理
const articleImgsWidth = this.$refs.articleImgs.getBoundingClientRect().width
this.imageHeight = articleImgsWidth * 0.5625
for (const n in this.Articels) {