问题
I tried to add appbar with WP8.1 using html5
and I use this link to guide me
Quickstart: Adding an app bar with commands (HTML)
But it shows me this problem (a bug) with no error, as you see the image.
回答1:
this is my solution
page default.html
CheckCnxInternetfor the default.js let it with no modifcation,
no code of Appbar.js
(function () {
"use strict";
var appBar;
var cx = new Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
var page = WinJS.UI.Pages.define("default.html", {
ready: function (element, options) {
appBar = document.getElementById("createAppBar").winControl;
appBar.getCommandById("cmdAdd").addEventListener("click", doClickAdd, false);
appBar.getCommandById("cmdRemove").addEventListener("click", doClickRemove, false);
appBar.getCommandById("cmdEdit").addEventListener("click", doClickEdit, false);
appBar.getCommandById("cmdCamera").addEventListener("click", doClickCamera, false);
}
});
// Command button functions
function doClickAdd() {
WinJS.log && WinJS.log("Add button pressed", "sample", "status");
}
function doClickRemove() {
WinJS.log && WinJS.log("Remove button pressed", "sample", "status");
}
function doClickEdit() {
WinJS.log && WinJS.log("Edit button pressed", "sample", "status");
}
function doClickCamera() {
WinJS.log && WinJS.log("Camera button pressed", "sample", "status");
}
})();
I hope it helpful :)
来源:https://stackoverflow.com/questions/24779534/adding-an-app-bar-in-wp8-1-html5