https://github.com/debbl/vue-2048
https://github.com/debbl/vue-2048
typescript vue vue3
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/debbl/vue-2048
- Owner: Debbl
- Created: 2022-09-28T09:39:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-10T22:04:44.000Z (10 months ago)
- Last Synced: 2025-10-19T13:23:54.036Z (8 months ago)
- Topics: typescript, vue, vue3
- Language: Vue
- Homepage: https://game.aiwan.run/2048/
- Size: 416 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [Vue 2048](https://game.aiwan.run/2048/)
> 参考 https://github.com/gabrielecirulli/2048
# 技术栈
- Vue3
- TypeScript
- Vite
- UnoCSS
- VueUse
# 思路
## 布局
- container 是 relative,动态生成 absolute button 元素,添加 left 和 top
## 移动
> 以向上为例,x 为 0 的一列
- y = 1, x = 1
- y = 2, x = 2, 1
- y = 3, x = 3, 2, 1
> 遍历六次,每次取当前的和其上一个比较,是否合并或移动