簡體   English   中英

在default.js中處理ViewState處理程序的updateLayout方法永遠不會受到打擊

[英]ViewState handler updateLayout method never get hit when handled within default.js

我從一個空白模板開始,在該模板中獲取default.htm和default.js。 當應用程序從完全模式變為捕捉模式或填充模式等時,我想處理事件。我添加了updateLayout方法,但是當我在此處添加斷點時,它永遠不會命中。 准備方法的斷點被擊中。 我在這里做錯了什么?

// 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) {

        }
    });


})();

這有點令人困惑,但是updateLayout實際上不是事件處理程序。

從其他模板開始時包含的導航框架將處理其他事件( window.onresize ),並調用updateLayout函數(如果存在)。 例如,如果您使用Navigation模板創建一個新項目,並檢查navigator.js,您將看到onresize事件的處理位置,並調用了updateLayout函數。

如果從Blank模板開始,則此功能不可用,因此您將需要(a)處理onresize事件,(b)將navigator.js添加到您的項目中,或者(c)使用其他項目模板。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM