继续落子修复;新增战绩;优化UI
This commit is contained in:
parent
c2a44ba7c7
commit
c389bb7d95
17
src/App.vue
17
src/App.vue
@ -230,8 +230,6 @@ export default {
|
||||
current: 0,
|
||||
max: 0,
|
||||
maxLose: 0,
|
||||
player: 0,
|
||||
computer: 0,
|
||||
},
|
||||
},
|
||||
winningPositions: null, // 保存获胜时的高亮状态
|
||||
@ -1238,14 +1236,15 @@ export default {
|
||||
} else {
|
||||
stats.playerWins++
|
||||
stats.winningStreaks.current = Math.max(0, stats.winningStreaks.current) + 1
|
||||
stats.winningStreaks.max = Math.max(
|
||||
stats.winningStreaks.max,
|
||||
stats.winningStreaks.current,
|
||||
)
|
||||
}
|
||||
} else if (winner === (this.isPlayerBlack ? 1 : 2)) {
|
||||
stats.playerWins++
|
||||
stats.winningStreaks.current = Math.max(0, stats.winningStreaks.current) + 1
|
||||
stats.winningStreaks.player = Math.max(
|
||||
stats.winningStreaks.player,
|
||||
stats.winningStreaks.current,
|
||||
)
|
||||
stats.winningStreaks.max = Math.max(stats.winningStreaks.max, stats.winningStreaks.current)
|
||||
} else {
|
||||
stats.computerWins++
|
||||
stats.winningStreaks.current = Math.min(0, stats.winningStreaks.current) - 1
|
||||
@ -1255,11 +1254,6 @@ export default {
|
||||
)
|
||||
}
|
||||
|
||||
stats.winningStreaks.max = Math.max(
|
||||
stats.winningStreaks.player,
|
||||
stats.winningStreaks.computer,
|
||||
)
|
||||
|
||||
// 保存到本地存储
|
||||
this.saveStatistics()
|
||||
},
|
||||
@ -1306,6 +1300,7 @@ export default {
|
||||
<style>
|
||||
/* 基础样式 */
|
||||
.container {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
@ -1,9 +1,9 @@
|
||||
@import './base.css';
|
||||
|
||||
#app {
|
||||
max-width: 1280px;
|
||||
/* max-width: 1280px; */
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
/* padding: 2rem; */
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@ -30,6 +30,6 @@ a,
|
||||
#app {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
padding: 0 2rem;
|
||||
/* padding: 0 2rem; */
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user