Skip to content

Commit 811d8b6

Browse files
committed
adds mobile support
1 parent 02f9eb9 commit 811d8b6

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

package-lock.json

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"format": "prettier --write src/"
1212
},
1313
"dependencies": {
14-
"vue": "^3.4.15"
14+
"vue": "^3.4.15",
15+
"vue3-touch-events": "^4.1.8"
1516
},
1617
"devDependencies": {
1718
"@rushstack/eslint-patch": "^1.3.3",

src/components/MineTile.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function revealCell() {
2424
2525
function markCell() {
2626
if (gameOver.value) return
27+
if (cell.value.revealed) return
2728
switch (cell.value.marked) {
2829
case '':
2930
cell.value.marked = '🚩'
@@ -62,6 +63,7 @@ const cellContent = computed(() => {
6263
'shadow-slate-600 border-r-2 border-b-2 border-slate-200': cell.revealed,
6364
'shadow-white border-r-2 border-b-2 border-slate-400': !cell.revealed
6465
}"
66+
v-touch:longtap="markCell"
6567
@click="revealCell"
6668
@click.right.prevent="markCell"
6769
>

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import './assets/main.css'
22

33
import { createApp } from 'vue'
44
import App from './App.vue'
5+
import Vue3TouchEvents from 'vue3-touch-events'
56

6-
createApp(App).mount('#app')
7+
createApp(App).use(Vue3TouchEvents).mount('#app')

0 commit comments

Comments
 (0)