vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
26 lines (25 loc) • 664 B
JavaScript
import { computed as l, ref as m } from "vue";
import { Utils as r } from "@vuux/utils";
const h = (e, t, a) => {
const n = l(() => [e.type, e.disabled ? "is-disabled" : "", e.loading ? "is-loading" : "", "is-" + e.size].filter(Boolean)), o = l(() => e.loading), s = l(() => e.items), i = m(!1), c = () => {
s.value.length > 0 && (i.value = !i.value);
}, d = (u, f) => {
i.value = !1, a("change", {
name: u,
i: f + 1
});
};
return r.useClickOutside(t, () => {
i.value = !1;
}), {
classNames: n,
isLoading: o,
lists: s,
isMore: i,
handleMore: c,
handleClick: d
};
};
export {
h as useSplitButton
};