EASYAIuniappNewUI/node_modules/@tuniao/tnui-vue3-uniapp/hooks/use-prop/index.ts
2025-02-08 18:50:38 +08:00

11 lines
346 B
TypeScript

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]
)
}