@cmstops/pro-compo
Version:
[物料平台文档中心](https://arco.design/docs/material/guide)
48 lines (47 loc) • 1.79 kB
JavaScript
;
var vue = require("vue");
var index$4 = require("../components/List/ListVideo/index.js");
var index = require("../components/List/ListNormal/index.js");
var index$2 = require("../components/List/ListSystem/index.js");
var index$1 = require("../components/List/ListLocal/index.js");
var index$3 = require("../components/List/ListAi/index.js");
const DEFAULT_TABS = ["all", "my", "remind", "local"];
const TAB_DICT = {
["all"]: { title: "\u5168\u90E8\u7D20\u6750", component: index },
["my"]: { title: "\u6211\u7684\u7D20\u6750", component: index },
["remind"]: { title: "\u63D0\u9192\u6211\u7684", component: index },
["local"]: { title: "\u672C\u5730\u7D20\u6750", component: index$1 },
["system"]: { title: "\u5185\u7F6E\u7D20\u6750", component: index$2 },
["ai"]: { title: "\u6B63\u6587\u7D20\u6750", component: index$3 },
["video"]: { title: "\u89C6\u9891\u5C01\u9762", component: index$4 }
};
function useTabFilter(props) {
const activeKey = vue.ref("all");
const curTab = vue.computed(() => TAB_DICT[activeKey.value]);
const tabKeyList = vue.computed(() => {
const { mediaUseType, aiThumbList, videoThumbOptions } = props;
const keys = JSON.parse(JSON.stringify(DEFAULT_TABS));
if (mediaUseType > 0)
keys.unshift("system");
if (aiThumbList && aiThumbList.length)
keys.unshift("ai");
if (videoThumbOptions)
keys.unshift("video");
[activeKey.value] = keys;
return keys.map((key) => ({
key,
title: TAB_DICT[key].title
}));
});
const activeComponent = vue.computed(() => curTab.value.component);
function handelChangeTab(tabKey) {
activeKey.value = tabKey;
}
return {
activeKey,
activeComponent,
tabKeyList,
handelChangeTab
};
}
module.exports = useTabFilter;