在頁面上加載表格后,我正在嘗試啟用禁用按鈕。
self.uploadPdfButtonIsEnabled = false;
self.pricingTableRenderedHandler = function (data, stateName) {
self.uploadPdfButtonIsEnabled = true;
//some other irrelevant logic
}
.cshtml 檔案
<button class="button button--primary" id="uploadPdfsButton" data-bind="click: $root.openPdfUpload, enable: uploadPdfButtonIsEnabled">
<span class="button__text">Upload PDF</span>
</button>
結果,我只禁用了這個按鈕并且沒有啟用它。嘗試除錯并輸入了pricingTableRenderedHandler,uploadPdfButtonIsEnabled變為true但按鈕仍然被禁用
uj5u.com熱心網友回復:
您必須使用 observable 才能使淘汰賽系結能夠自動更新:
// Pass the initial value: `false`
self.uploadPdfButtonIsEnabled = ko.observable(false);
self.pricingTableRenderedHandler = function (data, stateName) {
// Update by calling with the new value: `true`
self.uploadPdfButtonIsEnabled(true);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/497772.html
標籤:javascript 剃刀 淘汰赛.js
