@opentiny/vue-renderless
Version:
An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
25 lines (24 loc) • 527 B
JavaScript
import "../chunk-G2ADBYYC.js";
import { emitEvent } from "@opentiny/utils";
const toggle = ({ api, state }) => () => {
state.isShow ? api.collapse() : api.expand();
};
const expand = ({ emit, state }) => () => {
if (!emitEvent(emit, "before-expand")) {
return;
}
state.isShow = true;
emit("expand", true);
};
const collapse = ({ emit, state }) => () => {
if (!emitEvent(emit, "before-collapse")) {
return;
}
state.isShow = false;
emit("collapse", false);
};
export {
collapse,
expand,
toggle
};