使用 ifnot 绑定在虚拟元素中使用 'static'
use of 'static' in Virtual element in knockout with ifnot binding
我正在检查一段 knockout 代码,我发现了这一行...
<!-- ko ifnot: static -->
//your code
<!-- ko --> "
我了解了虚拟元素以及 if 和 ifnot 绑定的使用,但我不明白这一行的作用。
在 Chrome 中打开您的应用程序,打开开发人员工具并 select 评论元素 <!-- ko ifnot: static -->
。然后在控制台中 运行,ko.dataFor([=11=])
,这将为您提供绑定到该元素的视图模型。您应该会在视图模型对象中看到 static
。
我正在检查一段 knockout 代码,我发现了这一行...
<!-- ko ifnot: static -->
//your code
<!-- ko --> "
我了解了虚拟元素以及 if 和 ifnot 绑定的使用,但我不明白这一行的作用。
在 Chrome 中打开您的应用程序,打开开发人员工具并 select 评论元素 <!-- ko ifnot: static -->
。然后在控制台中 运行,ko.dataFor([=11=])
,这将为您提供绑定到该元素的视图模型。您应该会在视图模型对象中看到 static
。