react-bootstrap选项卡有下划线

时间:2016-09-12 16:29:51

标签: javascript css reactjs react-bootstrap

我使用的是React-Bootstrap框架,我遇到了Tabs / Tab组件无法正确显示的问题。活动标签下有一个下划线:

imgur.com

这里是渲染代码:

const React = require('react');
const { Tabs, Tab } = require('react-bootstrap');

const Account = React.createClass({
    getInitialState() {
        return {
            activeTab: 1,
        };
    },
    componentWillMount() {
        const section = this.props.params.section ? this.props.params.section : 'contact';
        let activeTab;

        switch (section) {
            case 'contact':
                activeTab = 1;
                break;
            case 'security':
                activeTab = 2;
                break;
            case 'notifications':
                activeTab = 3;
                break;
            default:
                // default to contact tab
                activeTab = 1;
                break;
        }

        this.setState({ activeTab });
    },
    render() {
        return (
            <div className="u__narrow">
                <h1 className="__page-title">Your Account</h1>
                <Tabs id="accountSections" activeKey={this.state.activeTab} onSelect={key => this.setState({activeTab: key })}>
                    <Tab eventKey={1} title="Contact Info">
                        <ContactInfo />
                    </Tab>
                    <Tab eventKey={2} title="Password & Security">
                        <Security />
                    </Tab>
                    <Tab eventKey={3} title="Email Notifications">
                        <Notifications />
                    </Tab>
                </Tabs>
            </div>
        );
    },
});

module.exports = Account;

我正在做与文档完全相同的事情,但我遇到了下划线问题

1 个答案:

答案 0 :(得分:0)

看起来你没有在你的页面中链接bootstrap css。请参阅文档中的样式表部分,React Bootstrap并不包含任何需要自己携带的css oyu。 ViennaCL