yanzhen-design-vue
Version:
50 lines (49 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const utilsVue = require("@yanzhen-libs/utils-vue");
const handleActiveTabKey = require("../utils/handleActiveTabKey.cjs");
function useContactsLoading({ activeTab, userActiveTab }) {
const loadings = vue.ref({
loading: false
});
const getLoadingKey = () => handleActiveTabKey.handleActiveTabKey({ activeTab, userActiveTab }, "loading");
const loading = vue.computed({
get() {
const key = getLoadingKey();
return utilsVue.unref(loadings)[key];
},
set(loading2) {
const key = getLoadingKey();
utilsVue.unref(loadings)[key] = loading2;
for (const [k] of Object.entries(utilsVue.unref(loadings))) {
if (key !== k) {
utilsVue.unref(loadings)[k] = false;
}
}
}
});
const mores = vue.ref({
more: false
});
const getMoreKey = () => handleActiveTabKey.handleActiveTabKey({ activeTab, userActiveTab }, "more");
const more = vue.computed({
get() {
const key = getMoreKey();
return utilsVue.unref(mores)[key];
},
set(more2) {
const key = getMoreKey();
utilsVue.unref(mores)[key] = more2;
}
});
return {
loading,
loadings,
getLoadingKey,
more,
mores,
getMoreKey
};
}
exports.useContactsLoading = useContactsLoading;