2
我在我的網站(https://github.com/mathieudutour/react-progress-button)中使用了一個加載按鈕對象,並且試圖將Material-UI FlatButton CSS傳遞給它,以便它看起來像與FlatButton相同。但是,我不知道如何做到這一點。如何將Material-UI FlatButton CSS傳遞到其他按鈕組件
import ProgressButton from 'react-progress-button'
const App = React.createClass({
getInitialState() {
return {
buttonState: ''
}
},
render() {
return (
<div>
<ProgressButton onClick={this.handleClick} state={this.state.buttonState}
style={//flat button CSS goes here.....}>
Go!
</ProgressButton>
</div>
)
},
handleClick() {
this.setState({buttonState: 'loading'})
// make asynchronous call
setTimeout(() => {
this.setState({buttonState: 'success'})
}, 3000)
}
})
感謝您的幫助。
謝謝。你認爲你可以將你的代碼放入我在OP中編寫的代碼中嗎?我不確定在哪裏放置它。謝謝。 – Alex
@Alex我更新了我的答案,希望它有幫助。 –
我收到一條錯誤消息「Uncaught TypeError:無法在'Window'上執行'getComputedStyle':參數1不是'Element'類型 – Alex