javascript 参考错误:PF 未定义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18076831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 10:40:14  来源:igfitidea点击:

ReferenceError: PF is not defined

javascriptjsf-2primefaces

提问by watou

I tried the NotificationBarexample of PrimeFaces, however it didn't work. I get the following JS error:

我尝试了PrimeFaces的NotificationBar示例,但它不起作用。我收到以下 JS 错误:

ReferenceError: PF is not defined

参考错误:PF 未定义

I think I need to include a library before using PF()function, but I don't know which library and where can I find it.

我想我需要在使用PF()函数之前包含一个库,但我不知道哪个库以及在哪里可以找到它。

回答by BalusC

The JS function PF()is only available since 4.0. You're apparently using PF 3.x. Look at the footer of the showcase site, it's currently saying that it's running PF 4.0.

JS 功能PF()仅从 4.0 开始可用。您显然在使用 PF 3.x。查看展示站点的页脚,目前说它正在运行 PF 4.0。

Just use widgetVar.show(), where widgetVaris the widget variable name as you specified in widgetVar, which is barin their showcase example.

只需使用widgetVar.show()widgetVar您在 中指定的小部件变量名称在哪里widgetVarbar在他们的展示示例中。

<p:commandButton value="Show" onclick="bar.show()" type="button" />  
<p:commandButton value="Hide" onclick="bar.hide()" type="button" />