<div data-bind="visible:see()==1 " style="display:none" id="test"></div>问题:当self.see() == 1 的时候 div还是没有显示,查看了官方文档没有具体这方面的问题.
<div data-bind="visible:see()==1 " style="display:none" id="test"></div>问题:当self.see() == 1 的时候 div还是没有显示,查看了官方文档没有具体这方面的问题.
调试欢乐多
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<div data-bind="style: { display: see() == 1 ? 'block' : 'none' }, html: text" style="display: none;" id="test">Somthing</div>
</body>
</html>
<script src="../../Script/knockout/knockout3.4.0.min.js"></script>
<script>
var viewModel = {
see: function () { return 1 },
text: new Date()
}
ko.applyBindings(viewModel);
</script>