From 18a3e80864d49169b4e07b21b662af9a83a0cd2f Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sat, 4 Jul 2020 21:20:01 +0800 Subject: [PATCH] chore: add src-next folder --- {src => src-next}/hooks/use-click-outside.ts | 0 {src => src-next}/hooks/use-global-event.ts | 2 +- {src => src-next}/hooks/use-lock-scroll.ts | 0 {src => src-next}/hooks/use-touch.ts | 8 ++++---- tsconfig.json | 1 + vant.config.js | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) rename {src => src-next}/hooks/use-click-outside.ts (100%) rename {src => src-next}/hooks/use-global-event.ts (92%) rename {src => src-next}/hooks/use-lock-scroll.ts (100%) rename {src => src-next}/hooks/use-touch.ts (84%) diff --git a/src/hooks/use-click-outside.ts b/src-next/hooks/use-click-outside.ts similarity index 100% rename from src/hooks/use-click-outside.ts rename to src-next/hooks/use-click-outside.ts diff --git a/src/hooks/use-global-event.ts b/src-next/hooks/use-global-event.ts similarity index 92% rename from src/hooks/use-global-event.ts rename to src-next/hooks/use-global-event.ts index 319c043bf..a5f453001 100644 --- a/src/hooks/use-global-event.ts +++ b/src-next/hooks/use-global-event.ts @@ -1,4 +1,4 @@ -import { on, off } from '../utils/dom/event'; +import { on, off } from '../../src/utils/dom/event'; import { Ref, watch, diff --git a/src/hooks/use-lock-scroll.ts b/src-next/hooks/use-lock-scroll.ts similarity index 100% rename from src/hooks/use-lock-scroll.ts rename to src-next/hooks/use-lock-scroll.ts diff --git a/src/hooks/use-touch.ts b/src-next/hooks/use-touch.ts similarity index 84% rename from src/hooks/use-touch.ts rename to src-next/hooks/use-touch.ts index aaaa5fb5c..44466fe01 100644 --- a/src/hooks/use-touch.ts +++ b/src-next/hooks/use-touch.ts @@ -39,10 +39,10 @@ export function useTouch() { function move(event: TouchEvent) { const touch = event.touches[0]; - deltaX.value = touch.clientX - this.startX; - deltaY.value = touch.clientY - this.startY; - offsetX.value = Math.abs(this.deltaX); - offsetY.value = Math.abs(this.deltaY); + deltaX.value = touch.clientX - startX.value; + deltaY.value = touch.clientY - startY.value; + offsetX.value = Math.abs(deltaX.value); + offsetY.value = Math.abs(deltaY.value); if (!direction.value) { direction.value = getDirection(offsetX.value, offsetY.value); diff --git a/tsconfig.json b/tsconfig.json index c0484590a..2e7200711 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,7 @@ "include": [ "types/**/*", "src/**/*", + "src-next/**/*" ], "exclude": [ "**/*.spec.ts", diff --git a/vant.config.js b/vant.config.js index f1af8287d..5aa319d97 100644 --- a/vant.config.js +++ b/vant.config.js @@ -1,7 +1,7 @@ module.exports = { name: 'vant', build: { - srcDir: 'src-v3', + srcDir: 'src-next', skipInstall: ['lazyload'], site: { publicPath: 'https://b.yzcdn.cn/vant/',