在MVVM模式中,我们将Button的方法写到ViewModel中,然后绑定到前端界面.通常的做法是写一个类,继承ICommand接口,然而如果按钮比较多的话,就需要写很多的类,对于后期维护造成很大的不变,微软提供了一个DelegateCommand类,可以简化开发. 使用方法如下: 首先生命ViewModel属性,GetMsg函数, public DelegateCommand GetMsg { get { return new DelegateCommand(GetMessage); } }…
document.onclick = function (e) { var e = e ? e : window.event; var tar = e.srcElement || e.target; if (tar.id != "searchData") { pagesZone.style.display = "none"; } } 以上代码在电脑浏览器和安卓上都能触发alert事件,但是在iOS上却完全没有反应. 如果这个name标签是button的可click事…