mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
8 lines
263 B
TypeScript
8 lines
263 B
TypeScript
|
import { getCurrentInstance, computed } from 'vue'
|
||
|
import type { ComputedRef } from 'vue'
|
||
|
|
||
|
export const useProp = <T>(name: string): ComputedRef<T | undefined> => {
|
||
|
const vm = getCurrentInstance()!
|
||
|
return computed(() => vm.proxy?.$props[name] ?? undefined)
|
||
|
}
|