升级写法兼容
This commit is contained in:
parent
ab3e337e60
commit
e7423df44e
107
nuxt.config.js
107
nuxt.config.js
@ -1,62 +1,103 @@
|
|||||||
const pkg = require('./package')
|
const pkg = require('./package')
|
||||||
|
|
||||||
|
const DevBaseUrl = 'http://127.0.0.1:65534'
|
||||||
|
const ProdBashUrl = 'https://api.wyr.me'
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: 'universal',
|
mode: 'universal',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Headers of the page
|
** Headers of the page
|
||||||
*/
|
*/
|
||||||
head: {
|
head: {
|
||||||
title: pkg.name,
|
title: '轶哥博客',
|
||||||
meta: [
|
htmlAttrs: {
|
||||||
{ charset: 'utf-8' },
|
lang: 'zh-cn'
|
||||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
},
|
||||||
{ hid: 'description', name: 'description', content: pkg.description }
|
meta: [{
|
||||||
|
charset: 'utf-8'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'viewport',
|
||||||
|
content: 'width=device-width, initial-scale=1, user-scalable=no'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'http-equiv': 'X-UA-Compatible',
|
||||||
|
content: 'IE=edge, chrome=1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hid: 'description',
|
||||||
|
name: 'description',
|
||||||
|
content: '一个全栈程序员的技术博客。'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
link: [
|
link: [{
|
||||||
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
|
rel: 'stylesheet',
|
||||||
|
href: 'https://cdn.wyr.me/css/begin.css'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rel: 'stylesheet',
|
||||||
|
href: 'https://cdn.wyr.me/css/highlight/atom-one-light.css'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rel: 'icon',
|
||||||
|
type: 'image/x-icon',
|
||||||
|
href: '/favicon.ico'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Customize the progress-bar color
|
** Customize the progress-bar color
|
||||||
*/
|
*/
|
||||||
loading: { color: '#fff' },
|
loading: {
|
||||||
|
color: '#3B8070'
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Global CSS
|
** Global CSS
|
||||||
*/
|
*/
|
||||||
css: [
|
css: [],
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Plugins to load before mounting the App
|
||||||
|
*/
|
||||||
|
plugins: [{
|
||||||
|
src: '~/plugins/moment.js'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '~/plugins/vue.js',
|
||||||
|
ssr: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: '~/plugins/browser.js',
|
||||||
|
ssr: false
|
||||||
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Plugins to load before mounting the App
|
** Nuxt.js modules
|
||||||
*/
|
*/
|
||||||
plugins: [
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Nuxt.js modules
|
|
||||||
*/
|
|
||||||
modules: [
|
modules: [
|
||||||
// Doc: https://axios.nuxtjs.org/usage
|
// Doc: https://axios.nuxtjs.org/usage
|
||||||
'@nuxtjs/axios'
|
'@nuxtjs/axios'
|
||||||
],
|
],
|
||||||
/*
|
/*
|
||||||
** Axios module configuration
|
** Axios module configuration
|
||||||
*/
|
*/
|
||||||
axios: {
|
axios: {
|
||||||
// See https://github.com/nuxt-community/axios-module#options
|
// See https://github.com/nuxt-community/axios-module#options
|
||||||
|
baseURL: process.env.NODE_ENV === 'development' ? DevBaseUrl : ProdBashUrl // 配置API接口地址
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Build configuration
|
** Build configuration
|
||||||
*/
|
*/
|
||||||
build: {
|
build: {
|
||||||
/*
|
/*
|
||||||
** You can extend webpack config here
|
** You can extend webpack config here
|
||||||
*/
|
*/
|
||||||
extend(config, ctx) {
|
extend (config, ctx) {
|
||||||
// Run ESLint on save
|
// Run ESLint on save
|
||||||
if (ctx.isDev && ctx.isClient) {
|
if (ctx.isDev && ctx.isClient) {
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
@ -66,6 +107,10 @@ module.exports = {
|
|||||||
exclude: /(node_modules)/
|
exclude: /(node_modules)/
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
vendor: ['moment']
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
version: pkg.version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
let Articels = []
|
let Articels = []
|
||||||
const nowPage = params.page ? parseInt(params.page) : 1
|
const nowPage = params.page ? parseInt(params.page) : 1
|
||||||
|
|
||||||
const { data } = await $axios.$get('/public/article/list', {
|
const data = await $axios.$get('/public/article/list', {
|
||||||
params: {
|
params: {
|
||||||
page: nowPage,
|
page: nowPage,
|
||||||
num: 8,
|
num: 8,
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
for (const n in this.Articels) {
|
for (const n in this.Articels) {
|
||||||
if (this.Articels[n].postimages.length !== 0) {
|
if (this.Articels[n].postimages.length !== 0) {
|
||||||
for (const i in this.Articels[n].postimages) {
|
for (const i in this.Articels[n].postimages) {
|
||||||
const { data } = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
||||||
const widthValue = data.ImageWidth.value
|
const widthValue = data.ImageWidth.value
|
||||||
const heightValue = data.ImageHeight.value
|
const heightValue = data.ImageHeight.value
|
||||||
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
let Articels = []
|
let Articels = []
|
||||||
const nowPage = params.page ? parseInt(params.page) : 1
|
const nowPage = params.page ? parseInt(params.page) : 1
|
||||||
|
|
||||||
const { data } = await $axios.$get('/public/article/list', {
|
const data = await $axios.$get('/public/article/list', {
|
||||||
params: {
|
params: {
|
||||||
page: nowPage,
|
page: nowPage,
|
||||||
num: 8,
|
num: 8,
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
for (const n in this.Articels) {
|
for (const n in this.Articels) {
|
||||||
if (this.Articels[n].postimages.length !== 0) {
|
if (this.Articels[n].postimages.length !== 0) {
|
||||||
for (const i in this.Articels[n].postimages) {
|
for (const i in this.Articels[n].postimages) {
|
||||||
const { data } = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
||||||
const widthValue = data.ImageWidth.value
|
const widthValue = data.ImageWidth.value
|
||||||
const heightValue = data.ImageHeight.value
|
const heightValue = data.ImageHeight.value
|
||||||
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
let Articels = []
|
let Articels = []
|
||||||
const nowPage = params.page ? parseInt(params.page) : 1
|
const nowPage = params.page ? parseInt(params.page) : 1
|
||||||
|
|
||||||
const { data } = await $axios.$get('/public/article/list', {
|
const data = await $axios.$get('/public/article/list', {
|
||||||
params: {
|
params: {
|
||||||
page: nowPage,
|
page: nowPage,
|
||||||
num: 8,
|
num: 8,
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
for (const n in this.Articels) {
|
for (const n in this.Articels) {
|
||||||
if (this.Articels[n].postimages.length !== 0) {
|
if (this.Articels[n].postimages.length !== 0) {
|
||||||
for (const i in this.Articels[n].postimages) {
|
for (const i in this.Articels[n].postimages) {
|
||||||
const { data } = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
||||||
const widthValue = data.ImageWidth.value
|
const widthValue = data.ImageWidth.value
|
||||||
const heightValue = data.ImageHeight.value
|
const heightValue = data.ImageHeight.value
|
||||||
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
||||||
|
@ -38,7 +38,7 @@ div
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
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 data = await $axios.$get(`/public/article/details?id=${route.params.id}`)
|
||||||
const result = data.result
|
const result = data.result
|
||||||
result.post_date = app.$moment(result.post_date).utc().format('lll')// 格式化时间
|
result.post_date = app.$moment(result.post_date).utc().format('lll')// 格式化时间
|
||||||
// 热度值计算
|
// 热度值计算
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
let Articels = []
|
let Articels = []
|
||||||
const nowPage = params.page ? parseInt(params.page) : 1
|
const nowPage = params.page ? parseInt(params.page) : 1
|
||||||
|
|
||||||
const { data } = await $axios.$get('/public/article/list', {
|
const data = await $axios.$get('/public/article/list', {
|
||||||
params: {
|
params: {
|
||||||
page: nowPage,
|
page: nowPage,
|
||||||
num: 8,
|
num: 8,
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
for (const n in this.Articels) {
|
for (const n in this.Articels) {
|
||||||
if (this.Articels[n].postimages.length !== 0) {
|
if (this.Articels[n].postimages.length !== 0) {
|
||||||
for (const i in this.Articels[n].postimages) {
|
for (const i in this.Articels[n].postimages) {
|
||||||
const { data } = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
||||||
const widthValue = data.ImageWidth.value
|
const widthValue = data.ImageWidth.value
|
||||||
const heightValue = data.ImageHeight.value
|
const heightValue = data.ImageHeight.value
|
||||||
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
let Articels = []
|
let Articels = []
|
||||||
const nowPage = params.page ? parseInt(params.page) : 1
|
const nowPage = params.page ? parseInt(params.page) : 1
|
||||||
|
|
||||||
const { data } = await $axios.$get('/public/article/list', {
|
const data = await $axios.$get('/public/article/list', {
|
||||||
params: {
|
params: {
|
||||||
page: nowPage,
|
page: nowPage,
|
||||||
num: 8,
|
num: 8,
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
for (const n in this.Articels) {
|
for (const n in this.Articels) {
|
||||||
if (this.Articels[n].postimages.length !== 0) {
|
if (this.Articels[n].postimages.length !== 0) {
|
||||||
for (const i in this.Articels[n].postimages) {
|
for (const i in this.Articels[n].postimages) {
|
||||||
const { data } = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
||||||
const widthValue = data.ImageWidth.value
|
const widthValue = data.ImageWidth.value
|
||||||
const heightValue = data.ImageHeight.value
|
const heightValue = data.ImageHeight.value
|
||||||
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
let Articels = []
|
let Articels = []
|
||||||
const nowPage = params.page ? parseInt(params.page) : 1
|
const nowPage = params.page ? parseInt(params.page) : 1
|
||||||
|
|
||||||
const { data } = await $axios.$get('/public/article/list', {
|
const data = await $axios.$get('/public/article/list', {
|
||||||
params: {
|
params: {
|
||||||
page: nowPage,
|
page: nowPage,
|
||||||
num: 8,
|
num: 8,
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
for (const n in this.Articels) {
|
for (const n in this.Articels) {
|
||||||
if (this.Articels[n].postimages.length !== 0) {
|
if (this.Articels[n].postimages.length !== 0) {
|
||||||
for (const i in this.Articels[n].postimages) {
|
for (const i in this.Articels[n].postimages) {
|
||||||
const { data } = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
const data = await this.$axios.$get(this.Articels[n].postimages[i].guid + '?x-oss-process=image/info')
|
||||||
const widthValue = data.ImageWidth.value
|
const widthValue = data.ImageWidth.value
|
||||||
const heightValue = data.ImageHeight.value
|
const heightValue = data.ImageHeight.value
|
||||||
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
if (widthValue > articleImgsWidth && (articleImgsWidth * heightValue / widthValue > this.imageHeight) && this.Articels[n].postImages.length < 10) {
|
||||||
|
@ -56,7 +56,7 @@ export const actions = {
|
|||||||
|
|
||||||
commit('setLeftDatas', datas)
|
commit('setLeftDatas', datas)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err && err.response && err.response.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user