3
У меня есть простое всплывающее окно, которое я хочу использовать в компонентах. Он не связывает данные во всплывающем окне, а в других частях компонентов, которые он делает?JQM/нокаутJS компонент popup не связывает данные?
ViewModel
ko.components.register('customer-search', {
viewModel: function(){
var self = this;
//data
self.search= ko.observable();
self.list= ko.observableArray([{supCode:"CHO024",supName:"supplier"}]);
self.next= ko.observable();
self.prev= ko.observable();
self.testText= ko.observable('test');
//general vars
ko.bindingHandlers.applyJQueryMobileStuff = {
init: function(elem) {
$(elem).trigger("create");
}
}
},
template:
'<div class="customer-search" data-bind="applyJQueryMobileStuff: true">\
<input type="text" data-bind="value: testText"/><br>\
\
<a href="#popupSearch1" data-rel="popup" data-position-to="window" data-role="button" data-transition="slideup" id="test" data-dismissible="false">Choose Customer</a>\
<div data-role="popup" id="popupSearch1" data-overlay-theme="d" data-theme="a" class="ui-corner-all" style="max-width:600px;">\
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-left">Close</a>\
<div data-role="header" data-theme="b" class="ui-corner-top">\
<h4>Customer Search</h4>\
</div>\
<div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">\
<input type="text" name="searchSupplier" placeholder="Customer Name" data-bind="value: testText"/>\
</div>\
</div>\
<\div>\
'
});
вид
<div data-bind='component: { name: "customer-search"}'></div>
Просто поместите это в какой-либо части содержания
Почему downvote? – user3023313