Compare commits

...

5 Commits

Author SHA1 Message Date
chenjiahan
42a5f79c2c docs(@vant/use): changelog v1.3.4 2021-11-18 15:10:46 +08:00
chenjiahan
e0545b5568 release: @vant/use 1.3.4 2021-11-18 15:09:16 +08:00
chenjiahan
2a95498569 chore(@vant/use): fix circular dependency 2021-11-18 15:06:32 +08:00
neverland
0f4e9aed48
fix(@vant/use): useClickAway failed in SSR (#9899) 2021-11-18 15:00:11 +08:00
neverland
e1cafe61ed
fix(cli): absolute file paths don't work on Windows (#9898) 2021-11-18 14:47:32 +08:00
7 changed files with 17 additions and 10 deletions

View File

@ -1,7 +1,6 @@
import { get } from 'lodash-es';
import { existsSync, readFileSync } from 'fs';
import { createRequire } from 'module';
import { fileURLToPath } from 'url';
import { fileURLToPath, pathToFileURL } from 'url';
import { join, dirname, isAbsolute } from 'path';
function findRootDir(dir: string): string {
@ -58,11 +57,10 @@ export function getPackageJson() {
}
async function getVantConfigAsync() {
const require = createRequire(import.meta.url);
delete require.cache[VANT_CONFIG_FILE];
try {
return (await import(VANT_CONFIG_FILE)).default;
// https://github.com/nodejs/node/issues/31710
// absolute file paths don't work on Windows
return (await import(pathToFileURL(VANT_CONFIG_FILE).href)).default;
} catch (err) {
return {};
}

View File

@ -1,5 +1,9 @@
# Changelog
## v1.3.4
- Fix useClickAway failed in SSR
### v1.3.3
- Allow to call useWindowSize outside setup
@ -7,7 +11,7 @@
### v1.3.2
-Remove passive event polyfill
- Remove passive event polyfill
### v1.3.1

View File

@ -1,6 +1,6 @@
{
"name": "@vant/use",
"version": "1.3.3",
"version": "1.3.4",
"description": "Vant Composition API",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",

View File

@ -1,4 +1,5 @@
import { Ref, unref } from 'vue';
import { inBrowser } from '../utils';
import { useEventListener } from '../useEventListener';
export type UseClickAwayOptions = {
@ -10,6 +11,10 @@ export function useClickAway(
listener: EventListener,
options: UseClickAwayOptions = {}
) {
if (!inBrowser) {
return;
}
const { eventName = 'click' } = options;
const onClick = (event: Event) => {

View File

@ -46,7 +46,7 @@
"dependencies": {
"@vant/icons": "^1.7.1",
"@vant/popperjs": "^1.1.0",
"@vant/use": "^1.3.3"
"@vant/use": "^1.3.4"
},
"peerDependencies": {
"vue": "^3.0.0"

2
pnpm-lock.yaml generated
View File

@ -53,7 +53,7 @@ importers:
'@vant/cli': workspace:*
'@vant/icons': ^1.7.1
'@vant/popperjs': ^1.1.0
'@vant/use': ^1.3.3
'@vant/use': ^1.3.4
'@vue/compiler-sfc': ^3.2.20
'@vue/runtime-core': ^3.2.20
'@vue/test-utils': ^2.0.0-rc.16