diff --git a/src/components/game2048/Game2048.vue b/src/components/game2048/Game2048.vue
index 687a825..cd7463a 100644
--- a/src/components/game2048/Game2048.vue
+++ b/src/components/game2048/Game2048.vue
@@ -624,7 +624,6 @@ async function mergeTiles(direction: Directions) {
await Promise.all(tileAddPromises.concat(addRandomTiles(changed ? 1 : 0).promise));
return Object.values(Directions).some((d) => getMergedGrid(d)[1]);
}
-
function onMaskClick() {
hideMask.value = true;
}
diff --git a/src/components/game2048/Game2048V2.vue b/src/components/game2048/Game2048V2.vue
new file mode 100644
index 0000000..7ae9f8a
--- /dev/null
+++ b/src/components/game2048/Game2048V2.vue
@@ -0,0 +1,400 @@
+
+
+
+
+
+
+ {{ tile.number }}
+
+
+
+
+
+
diff --git a/src/components/table/DataTableV2.vue b/src/components/table/DataTableV2.vue
new file mode 100644
index 0000000..d37d660
--- /dev/null
+++ b/src/components/table/DataTableV2.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
diff --git a/src/components/table/UserTable.vue b/src/components/table/UserTable.vue
index 186683f..a9d1052 100644
--- a/src/components/table/UserTable.vue
+++ b/src/components/table/UserTable.vue
@@ -7,12 +7,11 @@
>
-
- {{ userAuthNameMapping[(row as T).auth.id] ?? row.auth.name }}
+ {{ userAuthNameMapping[row.auth.id] ?? row.auth.name }}
- {{ clubAuthNameMapping[(row as T).clubAuth?.id ?? 'NONE'] ?? row.clubAuth.name }}
+ {{ clubAuthNameMapping[row.clubAuth?.id ?? 'NONE'] ?? row.clubAuth?.name }}
diff --git a/src/router/index.ts b/src/router/index.ts
index 40958a9..6302301 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -47,6 +47,10 @@ const routes: RouteRecordRaw[] = [
breadcrumb: '首页',
},
},
+ {
+ path: '/test',
+ component: () => import('@/components/table/DataTableV2.vue'),
+ },
{
path: '/user/:id',
name: 'User',
@@ -93,6 +97,11 @@ const routes: RouteRecordRaw[] = [
name: '2048',
component: () => import('@/views/Game2048Page.vue'),
},
+ {
+ path: '/2048v2',
+ name: '2048v2',
+ component: () => import('@/views/Game2048PageV2.vue'),
+ },
{
path: '/gobang',
name: 'GobangList',
@@ -203,17 +212,17 @@ router.beforeEach(async (to) => {
const userStore = useUserStore();
const pageStore = usePageStore();
pageStore.setNewRouteId(to);
- if (!userStore.userInfo) {
- const succeed = await userStore.updateSelfUserInfo();
- if (!succeed) {
- return pageStore.createTempErrorRoute(
- {
- type: PageErrorType.NETWORK_ERROR,
- },
- to,
- );
- }
- }
+ // if (!userStore.userInfo) {
+ // const succeed = await userStore.updateSelfUserInfo();
+ // if (!succeed) {
+ // return pageStore.createTempErrorRoute(
+ // {
+ // type: PageErrorType.NETWORK_ERROR,
+ // },
+ // to,
+ // );
+ // }
+ // }
const type = userStore.isRouteAccessible(to.fullPath);
if (type !== true) {
diff --git a/src/utils/array.ts b/src/utils/array.ts
index 2aa86c4..8f05094 100644
--- a/src/utils/array.ts
+++ b/src/utils/array.ts
@@ -32,6 +32,12 @@ export function* zip[]>(...its: T): Generator
yield nextValues.map(({ value }) => value) as any;
}
}
+export function* entries(it: Iterable): Generator<[number, T], void, unknown> {
+ let i = 0;
+ for (const value of it) {
+ yield [i++, value];
+ }
+}
export function get2DArrayItem(
grid: T[][],
first: number,
@@ -46,3 +52,4 @@ export function ensureArray(obj: unknown) {
}
export const arrayIncludes = (array: T[], value: R): value is T & R =>
array.includes(value as any);
+export const len = (len: number) => ({ length: len });
diff --git a/src/utils/index.ts b/src/utils/index.ts
index ddace2b..b5b1ca4 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -82,3 +82,6 @@ export function waitRef(ref: Ref, ...expect: R[]) {
*/
export const isKeyOf = (obj: T, key: keyof any): key is keyof typeof obj =>
key in obj;
+export const setProps = (obj: T, props: Partial): T => {
+ return Object.assign(obj, props);
+};
diff --git a/src/utils/types.ts b/src/utils/types.ts
index 4bb9339..1ff1a04 100644
--- a/src/utils/types.ts
+++ b/src/utils/types.ts
@@ -16,3 +16,6 @@ export type Rename<
};
export type Nullable = T | null | undefined;
export type ComparablePrimitive = Exclude;
+export type Exposed = {
+ [P in keyof T]: T[P];
+};
diff --git a/src/views/Game2048PageV2.vue b/src/views/Game2048PageV2.vue
new file mode 100644
index 0000000..b08d66a
--- /dev/null
+++ b/src/views/Game2048PageV2.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vite.config.ts b/vite.config.ts
index d4f7d67..a3105de 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,5 +1,6 @@
import legacy from '@vitejs/plugin-legacy';
import vue from '@vitejs/plugin-vue';
+import vueJsx from '@vitejs/plugin-vue-jsx';
import { resolve } from 'node:path';
import UnoCSS from 'unocss/vite';
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
@@ -16,6 +17,7 @@ export default defineConfig({
modernPolyfills: true,
}),
vue(),
+ vueJsx(),
Components({
resolvers: [
ElementPlusResolver(),