這裏是我在這個div標籤的代碼:需要0比空不同
<div className="lk-btn-group btn-group clear">
{this.state.invoiceId ? <button className="btn btn-primary btn-sm pull-left" onClick={() => this.printInvoice()}>{abp.localization.localize('PrintInvoice')}</button> : null}
{this.state.delivery.delivery && !this.state.invoiceId ? <button className="btn btn-primary btn-sm pull-left" onClick={() => this.printDeliveryNote()}>{abp.localization.localize('PrintDeliveryNote')}</button> : null}
{this.state.delivery.delivery == null ? <button className="btn btn-primary btn-sm pull-right" onClick={() => {
this.markAsDelivered()
}} disabled={!this.state.beginningPercentage || !this.state.gallonsDelivered}>{this.props.completeDelivery}</button> : <span className="label label-default pull-right"><i className="fa fa-check"></i> {this.props.deliveryComplete}</span>}
</div>
我的問題是如何得到的0(零)到輸入不是一樣的空?我需要用戶能夠繼續並設置0,並讓我的禁用按鈕顯示而不是已禁用。我相信它發生在== null
上面的div代碼的第四行,在我看來禁用「btn btn-primary btn-sm pull right」
這很好,如果用戶還沒有輸入任何內容,但我也需要將0視爲輸入的任何其他值,並且如果有意義的話,不僅僅爲空或空。我仍然需要所有其他功能保持不變。
0與C#或JavaScript中的null不同。不完全確定你的意思(顯然你知道'=='和'==='是不同的......只是檢查) –
[JavaScript檢查null與未定義以及==和===之間的區別](https://stackoverflow.com/questions/5101948/javascript-checking-for-null-vs-undefined-and-difference-between-and) –
它在c#(asp.net mvc項目),但實際的文件是編譯爲.js文件的.jsx文件。我所知道的是,只要我把0放在那裏,它仍然會禁用按鈕。我已經嘗試過===無濟於事。謝謝! – zberg007