我从一个空白模板开始,在那里我得到了一个default.htm和default.js。我想处理事件时,应用程序从完全到快照或填充模式等。我已经添加了updateLayout方法,但当我在这里添加断点,它永远不会被击中。ready方法的断点被击中了。我在这里做错什么了?
// For an introduction to the Page Control template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232511
(function () {
"use strict";
WinJS.UI.Pages.define("default.html", {
// This function is called whenever a user navigates to this page. It
// populates the page elements with the app's data.
ready: function (element, options) {
},
unload: function () {
// TODO: Respond to navigations away from this page.
},
updateLayout: function (element, viewState, lastViewState) {
}
});
})();发布于 2013-08-17 22:38:08
这有点让人困惑,但updateLayout实际上并不是一个事件处理程序。
从其他模板开始时包含的导航框架处理一个不同的事件(window.onresize),如果存在updateLayout函数,则调用它。例如,如果使用导航模板创建一个新项目并检查navigator.js,您将看到处理onresize事件的位置,以及调用updateLayout函数的位置。
如果从空白模板开始,此功能不到位,因此需要(a)处理onresize事件,(b)向项目添加navigator.js,或者(c)使用不同的项目模板。
https://stackoverflow.com/questions/18292587
复制相似问题