materialUI是封装起来的组件,如何下手改呢?
例如,把这个……
改成这样……
import React from 'react';
import Tabs from 'material-ui/lib/tabs/tabs';
import Tab from 'material-ui/lib/tabs/tab';
import Slider from 'material-ui/lib/slider';
const styles = {
headline: {
fontSize: 24,
paddingTop: 16,
marginBottom: 12,
fontWeight: 400,
},
};
function handleActive(tab) {
alert(`A tab with this route property ${tab.props.route} was activated.`);
}
const TabsExampleSimple = () => (
<Tabs>
<Tab label="Item One" >
<div>
<h2 style={styles.headline}>Tab One</h2>
<p>
This is an example tab.
</p>
<p>
You can put any sort of HTML or react component in here. It even keeps the component state!
</p>
<Slider name="slider0" defaultValue={0.5} />
</div>
</Tab>
<Tab label="Item Two" >
<div>
<h2 style={styles.headline}>Tab Two</h2>
<p>
This is another example tab.
</p>
</div>
</Tab>
<Tab
label="onActive"
route="/home"
onActive={handleActive}
>
<div>
<h2 style={styles.headline}>Tab Three</h2>
<p>
This is a third example tab.
</p>
</div>
</Tab>
</Tabs>
);
export default TabsExampleSimple;
看着这些代码,一筹莫展……
请告知思路,谢谢~
组件是封装(屏蔽)了一些东西,开放(扩展)了一些东西,如果这个不是组件提供的可选样式,那么你是不好改的。你可以改的是颜色之类的。
所以你的需求,要不找找是否有其他更适合的组件,例如list, menu等;要不自己去创建新的组件