UNPKG

@tuniao/tnui-vue3-uniapp

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