fix: use fromPairs replace Object.fromEntries (#5605)

* fix: use fromPairs replace Object.fromEntries

* fix: use lodash-es replace lodash
This commit is contained in:
bowen 2022-05-20 16:19:14 +08:00 committed by GitHub
parent bb85f1f372
commit fdf76b9fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import type { UnwrapRef } from 'vue';
import { reactive, toRef } from 'vue';
import fromPairs from 'lodash-es/fromPairs';
/**
* Reactively pick fields from a reactive object
@ -10,5 +11,5 @@ export function reactivePick<T extends object, K extends keyof T>(
obj: T,
...keys: K[]
): { [S in K]: UnwrapRef<T[S]> } {
return reactive(Object.fromEntries(keys.map(k => [k, toRef(obj, k)]))) as any;
return reactive(fromPairs(keys.map(k => [k, toRef(obj, k)]))) as any;
}