tab选项卡本身可以自己切换,但是希望同时也能用button按钮进行切换,怎么做到呢?
https://ant.design/components/steps/ 用这个插件
下一步是到第五步,不好意思
看一下html 的关系 ,这些选项卡应该是同级的 ,
下一步
$("buttonId").click(function(){
$(this).parent("父级标签页").hide().next( tab 标签页).show()
})
上一步
$("buttonId").click(function(){
$(this).parent("父级标签页").hide().prev( tab 标签页).show()
})
你地址里面不是有实例,不过看不懂什么语言。。。不是js的,api也没找到。。你这种功能tab来实现就行了吧。。如easyui的tab可以调用select选中对应的tab
import { Steps, Button, message } from 'antd';
const Step = Steps.Step;
const steps = [{
title: 'First',
content: 'First-content',
}, {
title: 'Second',
content: 'Second-content',
}, {
title: 'Last',
content: 'Last-content',
}];
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
current: 0,
};
}
next() {
const current = this.state.current + 1;
this.setState({ current });
}
prev() {
const current = this.state.current - 1;
this.setState({ current });
}
render() {
const { current } = this.state;
return (
<div>
<Steps current={current}>
{steps.map(item => <Step key={item.title} title={item.title} />)}
</Steps>
<div className="steps-content">{steps[this.state.current].content}</div>
<div className="steps-action">
{
this.state.current < steps.length - 1
&&
<Button type="primary" onClick={() => this.next()}>Next</Button>
}
{
this.state.current === steps.length - 1
&&
<Button type="primary" onClick={() => message.success('Processing complete!')}>Done</Button>
}
{
this.state.current > 0
&&
<Button style={{ marginLeft: 8 }} type="ghost" onClick={() => this.prev()}>
Previous
</Button>
}
</div>
</div>
);
}
}
“点击第三步”添加事件,然后在该事件中去点击“第三步”,即用jquery选中“第三步”Tab页,然后做.click()。
已经解决了,谢谢大家!!!