且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在按钮处于加载状态时向按钮添加微调图标?

更新时间:2023-12-05 16:32:28

如果你看一下 bootstrap-button.js源代码,您将看到引导插件在调用 $(myElem).button('loading')时将按钮内部 html 替换为 data-loading-text 中的任何内容>.

If you look at the bootstrap-button.js source, you'll see that the bootstrap plugin replaces the buttons inner html with whatever is in data-loading-text when calling $(myElem).button('loading').

对于你的情况,我认为你应该能够做到这一点:

For your case, I think you should just be able to do this:

<button type="button"
        class="btn btn-primary start"
        id="btnStartUploads"
        data-loading-text="<i class='icon-spinner icon-spin icon-large'></i> @Localization.Uploading">
    <i class="icon-upload icon-large"></i>
    <span>@Localization.StartUpload</span>
</button>