|
@@ -75,6 +75,15 @@
|
|
|
interface PopupData {
|
|
|
title: string;
|
|
|
}
|
|
|
+ interface Tab {
|
|
|
+ id: number;
|
|
|
+ name: string;
|
|
|
+ }
|
|
|
+ interface State {
|
|
|
+ tabs: Tab[];
|
|
|
+ current_tab: Tab;
|
|
|
+ disable_btn: boolean;
|
|
|
+ }
|
|
|
|
|
|
export default defineComponent({
|
|
|
// name: 'Content',
|
|
@@ -87,8 +96,8 @@
|
|
|
const popupData = reactive<PopupData>({
|
|
|
title: '',
|
|
|
});
|
|
|
- const state = reactive({
|
|
|
- tabs: [] as object[],
|
|
|
+ const state = reactive<State>({
|
|
|
+ tabs: [],
|
|
|
current_tab: { id: 0, name: '' },
|
|
|
disable_btn: true,
|
|
|
});
|
|
@@ -151,7 +160,7 @@
|
|
|
|
|
|
function afterFetch(result) {
|
|
|
if (state.current_tab.id && state.current_tab.name) {
|
|
|
- const list: any[] = [];
|
|
|
+ const list: Tab[] = [];
|
|
|
result.map((item) => {
|
|
|
if (item.category === state.current_tab.name) {
|
|
|
list.push(item);
|
|
@@ -162,7 +171,7 @@
|
|
|
}
|
|
|
function renderTab() {
|
|
|
getCategoryList({}).then((res) => {
|
|
|
- state.tabs = res.list;
|
|
|
+ state.tabs = res.list as Tab[];
|
|
|
state.tabs.unshift({ id: 0, name: '全部' });
|
|
|
});
|
|
|
}
|