Skip to content

Commit 86f8372

Browse files
committed
bugfix
1 parent 4161288 commit 86f8372

File tree

7 files changed

+17
-8
lines changed

7 files changed

+17
-8
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VUE_APP_host=http://www.fxss.work:3000
2-
VUE_APP_pathname=/myapp
1+
VUE_APP_host=http://www.fxss.work
2+
VUE_APP_pathname=/vue-blog
33
VUE_APP_title=樊小书生
44
VUE_APP_keywords=樊小书生的博客
55
VUE_APP_description=樊小书生的博客,多看代码,多看书,付出总会有收获的

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VUE_APP_host=http://localhost:3000

public/favicon.ico

0 Bytes
Binary file not shown.

src/components/PageHeader.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
index="6">
4848
<template slot="title">
4949
<div class="user-box clearfix">
50-
<img class="user-box_header-img fl" src="./../assets/header.jpg" alt="用户头像">
50+
<img class="user-box_header-img fl" :src="authorImg" alt="用户头像">
5151
<div class="user-box_name ellipsis">{{ userInfo.name }}</div>
5252
</div>
5353
</template>
@@ -134,6 +134,9 @@ export default {
134134
break
135135
}
136136
return res
137+
},
138+
authorImg () {
139+
return this.userInfo.authorHeadimg ? `${process.env.VUE_APP_host}/${this.userInfo.authorHeadimg}` : 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
137140
}
138141
},
139142
created () {},

src/plugins/axios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import store from './../store'
1111
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
1212

1313
let config = {
14-
// baseURL: process.env.baseURL || process.env.apiUrl || ""
14+
baseURL: process.env.VUE_APP_pathname
1515
// timeout: 60 * 1000, // Timeout
1616
// withCredentials: true, // Check cross-site Access-Control
1717
}

src/router/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,16 @@ const routes = [
7272
]
7373

7474
const router = new VueRouter({
75-
mode: 'history',
76-
base: '/vue-blog/',
75+
// 本地开始时注释
76+
// mode: 'history',
77+
// base: '/vue-blog/',
7778
routes,
7879
scrollBehavior (to, from, savedPosition) {
79-
if (savedPosition) {
80+
if (to.hash) {
81+
return {
82+
selector: to.hash
83+
}
84+
} else if (savedPosition) {
8085
return savedPosition
8186
} else {
8287
return {

src/views/AdminUser.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<el-form-item label="用户头像">
55
<el-upload
66
ref="headerUpload"
7-
action="/api/addUserHeader"
7+
action="/vue-blog/api/addUserHeader"
88
accept="image/png, image/jpeg"
99
list-type="picture-card"
1010
:file-list="fileList"

0 commit comments

Comments
 (0)