我希望浏览器以我指定的样式显示带有QuickTab组件的React应用程序。
CSS:
- The type TabbedPanes must implement the inherited abstract method
ActionListener.actionPerformed(ActionEvent)
这里是组件。为了简洁起见,我省略了其他开关盒。
QuickTab.js:
.MostPopular{
width: 20%;
height: 100px;
background-color: #0000FF;
border-radius: 0 0 30px 30px;
margin: 2% auto;
position: relative;
}
这是我App.js文件中的组件调用:
import React, {Component} from 'react';
import classes from './QuickTab.css';
import PropTypes from 'prop-types';
class QuickTab extends Component{
render(){
let quickTab = null;
switch(this.props.type){
case('most-popular'):
quickTab= <div className={classes.MostPopular}></div>
break;
default:
quickTab= null;
}
return quickTab;
}
}
//Add prop type validation
QuickTab.propTypes = {
type: PropTypes.string.isRequired
};
export default QuickTab;
答案 0 :(得分:1)
将className = {classes.MostPopular}替换为className =“ MostPopular”并像这样导入样式
导入'./QuickTab.css';
或
require('./ QuickTab.css');