@opensig/opendesign
Version:
<p align="center"><img src="../docs/public/opendesign-logo-light.png"/></p> <h1 align="center">opendesign</h1> <p align="center">一个 Vue 3 组件库</p> <p align="center"><b>皮肤可定制,使用 TypeScript</b></p>
20 lines (19 loc) • 486 B
JavaScript
import { uniqueId } from "../_utils/helper.mjs";
import { isFunction, isString, isNumber } from "../_utils/is.mjs";
const getUId = uniqueId;
const vUid = {
created(el, binding) {
const value = binding.value;
if (isFunction(value)) {
value(el, el.id || uniqueId());
} else if (isString(value) || isNumber(value)) {
el.setAttribute("id", String(value));
} else if (!el.id) {
el.setAttribute("id", uniqueId());
}
}
};
export {
getUId,
vUid
};