Auto Commit

上级 483e543d
...@@ -27,12 +27,18 @@ onMounted(confirm) ...@@ -27,12 +27,18 @@ onMounted(confirm)
function confirm() { function confirm() {
isWin = [] isWin = []
lattices.value = Array(size.value).fill([]).map(() => Array(size.value).fill(is_empty)) lattices.value = Array(size.value).fill([]).map(() => Array(size.value).fill(is_empty))
records.value = []
} }
function back(){ function back() {
Array(2) if (records.value.length < 2) return;
for (let i = 0; i < 2; i++) {
const { location: [y, x] } = records.value.pop()
lattices.value[y][x] = is_empty
}
isWin = []
} }
function setPiece([y, x], type){ function setPiece([y, x], type) {
records.value.push({ records.value.push({
location: [y, x], location: [y, x],
type: type type: type
...@@ -70,7 +76,7 @@ async function playChess(item, row, col) { ...@@ -70,7 +76,7 @@ async function playChess(item, row, col) {
<label for="win_size" class="space-nowrap">胜利棋数:</label> <label for="win_size" class="space-nowrap">胜利棋数:</label>
<input v-model="win_size" id="win_size" type="number" min="3" max="8"> <input v-model="win_size" id="win_size" type="number" min="3" max="8">
</p> </p>
<button @click="confirm" class="space-nowrap">重新开始</button> <button @click="confirm" class="space-nowrap mr-6px">重新开始</button>
<button @click="back" class="space-nowrap">返回上一步</button> <button @click="back" class="space-nowrap">返回上一步</button>
</div> </div>
<div class="content border-top content-lattice"> <div class="content border-top content-lattice">
......
...@@ -12,8 +12,6 @@ body, ...@@ -12,8 +12,6 @@ body,
} }
#app { #app {
margin: 0 auto;
font-weight: normal; font-weight: normal;
cursor: pointer; cursor: pointer;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册