knockout.js: update bindings?

Christian Engel提出了一个问题:knockout.js: update bindings?,或许与您遇到的问题类似。

回答者CommunityColinE给出了该问题的处理方式:

Each time you invoke ko.applyBindings the entire DOM is inspected for bindings. As a result you will get multiple bindings for each element if you do this more than once. If you just want to bind a new DOM element you can pass this element as a parameter to the applyBindings function:

---------------------------- ---------------------------------------

See this related question:

Can you call ko.applyBindings to bind a partial view?

希望本文对你有帮助,欢迎支持JavaScript中文网

来源:JavaScript中文网 ,转载请注明来源 本文地址:https://www.javascriptcn.com/post/27812