@coreui/vue
Version:
UI Components Library for Vue.js
19 lines (16 loc) • 405 B
JavaScript
import { ref } from 'vue';
const useUniqueId = (prefix = '') => {
const ids = ref([]);
const getUID = () => {
do {
prefix += Math.floor(Math.random() * 1_000_000);
} while (ids.value.includes(prefix));
ids.value.push(prefix);
return prefix;
};
return {
getUID,
};
};
export { useUniqueId };
//# sourceMappingURL=useUniqueId.js.map