UNPKG

ivue-material-plus

Version:

A high quality UI components Library with Vue.js

11 lines (7 loc) • 297 B
import { computed, getCurrentInstance } from 'vue'; // type import type { ComputedRef } from 'vue'; export const useProp = <T>(name: string): ComputedRef<T | undefined> => { const vm = getCurrentInstance()!; return computed(() => (vm.proxy?.$props as any)[name] ?? undefined); };