1) 修改tabpage 第一次不加载

This commit is contained in:
zhangds 2022-09-21 09:59:37 +08:00
parent 81c632cca4
commit 0866805d51
3 changed files with 21 additions and 4 deletions

View File

@ -228,7 +228,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
plan_id: "",
key_batch_id: "",
title: "",
date_time: "",
date_time: JSON.parse(sessionStorage.getItem("datetime")),
});
const form_info_el = useRef(null);

View File

@ -15,7 +15,25 @@ export default class tabbar extends React.Component {
};
}
componentDidMount() {
this.tabChange(0);
if (this.props.first) {
this.setState({ activeIndex: 0 });
let arr = [];
for (let i = 0; i < this.state.tabList.length; i++) {
let temp = this.state.tabList[i];
if (i == 0) {
temp.className = "tabbar active";
} else if (i == 0 - 1) {
temp.className = "tabbar none-border";
} else {
temp.className = "tabbar";
}
arr[i] = temp;
}
this.setState({ tabList: arr });
return;
} else {
this.tabChange(0);
}
}
tabChange(index) {
@ -33,7 +51,7 @@ export default class tabbar extends React.Component {
arr[i] = temp;
}
this.setState({ tabList: arr });
if (this.state.tabList.length > 1 && this.props.first !== true) {
if (this.state.tabList.length > 1) {
this.props.tabChange(index);
}
}

View File

@ -193,7 +193,6 @@ const UseCouponList = () => {
const selectionFun = () => {};
const searchCallback = () => {
setState({ isQuery: !state.isQuery });
// getTable();
};
const onPageChange = (data) => {
setState({ page: data, isQuery: !state.isQuery });