Skip to content

makeDestructurable

类别
导出大小
201 B
最近修改
2 days ago

同时为对象和数组创建同构的可解构功能。更多详细信息请参见 这篇博客

🌐 Make isomorphic destructurable for object and array at the same time. See this blog for more details.

用法

🌐 Usage

TypeScript 示例:

🌐 TypeScript Example:

ts
import { 
makeDestructurable
} from '@vueuse/core'
const
foo
= {
name
: 'foo' }
const
bar
= 1024
const
obj
=
makeDestructurable
(
{
foo
,
bar
} as
const
,
[
foo
,
bar
] as
const
,
)
js
import { makeDestructurable } from '@vueuse/core'
const foo = { name: 'foo' }
const bar = 1024
const obj = makeDestructurable({ foo, bar }, [foo, bar])

用法:

🌐 Usage:

ts
let { 
foo
,
bar
} =
obj
let [
foo
,
bar
] =
obj