Skip to content

Commit b0758bf

Browse files
authored
perf: import way (#229)
1 parent 2a8fd77 commit b0758bf

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

.vscode/setting.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"prettier.configPath": ".prettierrc"
3+
}

packages/hooks/src/createUseStorageState/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-empty */
21
import { unref, ref, Ref, UnwrapRef, watchEffect, readonly } from 'vue'
32

43
export interface IFuncUpdater<T> {

packages/hooks/src/useAsyncOrder/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useTimeout } from '../index'
1+
import useTimeout from '../useTimeout'
22

33
export type Resolve = (value: any) => void
44
export type InterruptibleRejectType = (error: any) => void

packages/hooks/src/useCounter/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Ref, readonly, ref } from 'vue'
21
import { isNumber } from '../utils'
32

3+
import { Ref, readonly, ref } from 'vue'
4+
45
export interface UseCounterOptions {
56
/**
67
* Min count

packages/hooks/src/useHover/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Ref } from 'vue'
2-
import { useBoolean } from '../index'
2+
import useBoolean from '../useBoolean'
33
import useEventListener from '../useEventListener'
44
import { BasicTarget } from '../utils/domTarget'
55

packages/hooks/src/useInfiniteScroll/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { computed, readonly, ref, shallowReadonly, watch } from "vue";
2-
import { useBoolean, useEventListener, useRequest } from "../index";
2+
import useBoolean from '../useBoolean'
3+
import useEventListener from '../useEventListener'
4+
import useRequest from '../useRequest'
35

46
import { getTargetElement } from "../utils/domTarget";
57

packages/hooks/src/useUrlState/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import qs from 'qs'
66
import { Ref, ref, watch, watchEffect } from 'vue'
7-
import { useLocalStorageState } from '../index'
7+
import useLocalStorageState from '../useLocalStorageState'
88
import { isFunction } from '../utils'
99

1010
export interface UseUrlStateOptions {
@@ -69,8 +69,8 @@ function useUrlState<S extends UrlState = Partial<UrlState>>(
6969

7070
const state_ = (localStorageKey
7171
? useLocalStorageState(localStorageKey, {
72-
defaultValue: defaultState,
73-
})[0]
72+
defaultValue: defaultState,
73+
})[0]
7474
: ref(defaultState)) as Ref<S>
7575

7676
const state = ref<S>() as Ref<S>
@@ -79,7 +79,6 @@ function useUrlState<S extends UrlState = Partial<UrlState>>(
7979
state.value = state_.value
8080
})
8181

82-
8382
// 初始状态 url > localstorage
8483
if (paramsStr) {
8584
try {
@@ -115,7 +114,6 @@ function useUrlState<S extends UrlState = Partial<UrlState>>(
115114
const newParamsStr = encodeParams(state.value)
116115
routerPushFn(`${path}?${newParamsStr}`)
117116
}
118-
119117
},
120118
{
121119
deep: true,
@@ -126,4 +124,4 @@ function useUrlState<S extends UrlState = Partial<UrlState>>(
126124
return state
127125
}
128126

129-
export default useUrlState
127+
export default useUrlState

0 commit comments

Comments
 (0)