vuestic-ui
Version:
Vue 3 UI Framework
1 lines • 821 B
Source Map (JSON)
{"version":3,"file":"useNumericProp.mjs","sources":["../../../../src/composables/useNumericProp.ts"],"sourcesContent":["import { computed, getCurrentInstance } from 'vue'\n\n/**\n * @param key key of props\n * @returns Numeric type of key attribute\n */\nexport const useNumericProp = (key: string) => {\n const props = getCurrentInstance()!.props\n\n const numericComputed = computed(() => {\n const numeric = props?.[key] as string | number | undefined\n\n if (numeric === undefined) {\n return numeric\n }\n\n return Number(numeric)\n })\n\n return numericComputed\n}\n"],"names":[],"mappings":";AAMa,MAAA,iBAAiB,CAAC,QAAgB;AACvC,QAAA,QAAQ,mBAAsB,EAAA;AAE9B,QAAA,kBAAkB,SAAS,MAAM;AAC/B,UAAA,UAAU,+BAAQ;AAExB,QAAI,YAAY,QAAW;AAClB,aAAA;AAAA,IACT;AAEA,WAAO,OAAO,OAAO;AAAA,EAAA,CACtB;AAEM,SAAA;AACT;"}