Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3f20a1e

Browse files
fix: mobile navbar rollup problem
1 parent 8b2302b commit 3f20a1e

File tree

7 files changed

+65
-25
lines changed

7 files changed

+65
-25
lines changed

‎.husky/commit-msg‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "0ドル")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "1ドル"

‎.husky/pre-commit‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "0ドル")/_/husky.sh"
3+
4+
npx lint-staged --allow-empty "1ドル"

‎commitlint.config.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* feat:新增功能
3+
* fix:bug 修复
4+
* docs:文档更新
5+
* style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
6+
* refactor:重构代码(既没有新增功能,也没有修复 bug)
7+
* perf:性能, 体验优化
8+
* test:新增测试用例或是更新现有测试
9+
* build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交
10+
* ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle等)的提交
11+
* chore:不属于以上类型的其他类型,比如构建流程, 依赖管理
12+
* revert:回滚某个更早之前的提交
13+
*/
14+
module.exports = {
15+
extends: ['@commitlint/config-conventional'],
16+
rules: {
17+
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'perf', 'refactor', 'test', 'chore', 'revert']],
18+
'subject-full-stop': [0, 'never'],
19+
'subject-case': [0, 'never']
20+
}
21+
}

‎package.json‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "",
66
"private": true,
77
"scripts": {
8-
"preinstall": "node ./preinstall.js",
8+
"preinstall": "node ./preinstall.js && husky install",
99
"dev": "cross-env NODE_ENV=development node server",
1010
"start": "cross-env NODE_ENV=production node server",
1111
"build": "rimraf dist && npm run build:client && npm run build:server && npm run copy",
@@ -20,11 +20,6 @@
2020
"eslint --fix --ext .js,.jsx,.vue"
2121
]
2222
},
23-
"husky": {
24-
"hooks": {
25-
"pre-commit": "npx lint-staged"
26-
}
27-
},
2823
"dependencies": {
2924
"@octokit/core": "^3.5.1",
3025
"archiver": "^2.1.1",
@@ -48,6 +43,8 @@
4843
"@babel/eslint-parser": "^7.17.0",
4944
"@babel/plugin-transform-runtime": "^7.17.0",
5045
"@babel/preset-env": "^7.16.0",
46+
"@commitlint/cli": "^16.2.3",
47+
"@commitlint/config-conventional": "^16.2.1",
5148
"autoprefixer": "^7.1.2",
5249
"babel-helper-vue-jsx-merge-props": "^2.0.3",
5350
"babel-loader": "^8.2.3",
@@ -74,12 +71,12 @@
7471
"friendly-errors-webpack-plugin": "^1.6.1",
7572
"fs-extra": "^10.0.1",
7673
"html-webpack-plugin": "^2.30.1",
77-
"husky": "4.2.5",
74+
"husky": "^7.0.4",
7875
"js-md5": "^0.7.3",
7976
"jsonwebtoken": "^8.5.1",
8077
"less": "^2.7.3",
8178
"less-loader": "^4.0.5",
82-
"lint-staged": "10.5.4",
79+
"lint-staged": "^12.3.7",
8380
"lru-cache": "^7.5.1",
8481
"md5": "^2.2.1",
8582
"mongoose": "^4.13.9",

‎src/views/components/submit.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export default {
252252
// 存储
253253
this.tempInfo = {
254254
name: info.nickname,
255-
imgUrl: info.figureurl_2,
255+
imgUrl: info.figureurl_qq_2||info.figureurl_2,
256256
type: 1,
257257
qqOpenId: openId
258258
}

‎src/views/home/index.vue‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ export default {
172172
background-position: center;
173173
background-size: cover;
174174
position: relative;
175-
@include flex-box-center;
176175
position: relative;
177176
}
178177
&__header:before {
@@ -189,6 +188,9 @@ export default {
189188
flex-direction: column;
190189
align-items: center;
191190
z-index: 10;
191+
width: 100%;
192+
position: absolute;
193+
top: 45%;
192194
transform: translateY(-20px);
193195
@include themeify() {
194196
color: themed('color-navbar');
@@ -200,17 +202,27 @@ export default {
200202
margin-top: 24px;
201203
padding: 0 16px;
202204
line-height: 1.5;
205+
@include respond-to(xs) {
206+
margin-top: 14px;
207+
font-size: 18px;
208+
line-height: 1.5;
209+
}
203210
}
204211
&__typed-cursor {
205-
display: inline-block;
206212
margin-left: 4px;
207213
font-size: 28px;
214+
@include respond-to(xs) {
215+
font-size: 18px;
216+
}
208217
}
209218
.is-typed-cursor-anmation {
210219
animation: typed 0.5s ease infinite alternate;
211220
}
212221
&__site-name {
213222
font-size: 36px;
223+
@include respond-to(xs) {
224+
font-size: 28px;
225+
}
214226
}
215227
&__go {
216228
position: absolute;

‎src/views/layout/components/navbar/index.vue‎

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,7 @@ export default {
5555
},
5656
mounted() {
5757
if (getScrollTop() == 0) this.rollbackTop = true
58-
window.addEventListener(
59-
'scroll',
60-
() => {
61-
const nowTopPos = getScrollTop()
62-
if (nowTopPos - this.lastTopPos > 0) {
63-
this.setRollBack(false)
64-
this.rollbackTop = false
65-
} else if (nowTopPos == 0) {
66-
this.rollbackTop = true
67-
} else this.setRollBack(true)
68-
this.lastTopPos = nowTopPos
69-
},
70-
false
71-
)
58+
window.addEventListener('scroll', this.scrollHandler)
7259
window.addEventListener('resize', this.resizeHandler)
7360
},
7461
computed: {
@@ -86,6 +73,17 @@ export default {
8673
closeSearch() {
8774
this.searchVisible = false
8875
},
76+
scrollHandler() {
77+
const nowTopPos = getScrollTop()
78+
// nowTopPos this.lastTopPos在移动端可为负数
79+
if (nowTopPos >= 0 && this.lastTopPos >= 0 && nowTopPos - this.lastTopPos > 0) {
80+
this.setRollBack(false)
81+
this.rollbackTop = false
82+
} else if (nowTopPos <= 0) {
83+
this.rollbackTop = true
84+
} else this.setRollBack(true)
85+
this.lastTopPos = nowTopPos
86+
},
8987
resizeHandler: debounce(function () {
9088
const width = document.documentElement.clientWidth
9189
@@ -94,6 +92,10 @@ export default {
9492
this.drawer = false
9593
}
9694
}, 200)
95+
},
96+
destroyed() {
97+
window.removeEventListener('scroll', this.scrollHandler)
98+
window.removeEventListener('resize', this.resizeHandler)
9799
}
98100
}
99101
</script>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /