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: "", plan_id: "",
key_batch_id: "", key_batch_id: "",
title: "", title: "",
date_time: "", date_time: JSON.parse(sessionStorage.getItem("datetime")),
}); });
const form_info_el = useRef(null); const form_info_el = useRef(null);

View File

@ -15,8 +15,26 @@ export default class tabbar extends React.Component {
}; };
} }
componentDidMount() { componentDidMount() {
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); this.tabChange(0);
} }
}
tabChange(index) { tabChange(index) {
this.setState({ activeIndex: index }); this.setState({ activeIndex: index });
@ -33,7 +51,7 @@ export default class tabbar extends React.Component {
arr[i] = temp; arr[i] = temp;
} }
this.setState({ tabList: arr }); this.setState({ tabList: arr });
if (this.state.tabList.length > 1 && this.props.first !== true) { if (this.state.tabList.length > 1) {
this.props.tabChange(index); this.props.tabChange(index);
} }
} }

View File

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