如何在 PF 6 中禁用 p:progressBar 过渡动画

How to disable p:progressBar transition animation in PF 6

我想禁用 p:progressBar 过渡 PF 6 中的动画。在 PF 7 中,这可以通过 animationDuration="0" 实现。 PF 6 有任何解决方法吗?

只需将此添加到您的 Javascript 即可覆盖 ProgressBar 并移除动画。

PF('progress').setValue = function(value) {
        if(value >= 0 && value<=100) {
            if(value == 0) {
                this.jqValue.hide().css('width', '0%').removeClass('ui-corner-right');

                this.jqLabel.hide();
            }
            else {
                if(this.cfg.labelTemplate) {
                    var formattedLabel = this.cfg.labelTemplate.replace(/{value}/gi, value);
                    this.jqLabel.text(formattedLabel).show();
                }
            }

            this.value = value;
            this.jq.attr('aria-valuenow', value);
        }
    }