function Page() {
}
Page.prototype = {
constructor: Page,
init: function() {
mui.init({
subpages: [{
url: 'mainlist.html',
id: 'a1',
styles: {
top: '45px', //mui标题栏默认高度为45px;
bottom: '49px' //默认为0px,可不定义;
}
}],
preloadPages: [ //缓存其他页面
{
url: 'journalism.html',
id: 'a2',
styles: {
top: '45px', //mui标题栏默认高度为45px;
bottom: '49px' //默认为0px,可不定义;
}
},
{
url: 'shoppingcart.html',
id: 'a3',
styles: {
top: '45px', //mui标题栏默认高度为45px;
bottom: '49px' //默认为0px,可不定义;
}
},
{
url: 'my.html',
id: 'a4',
styles: {
top: '45px', //mui标题栏默认高度为45px;
bottom: '49px' //默认为0px,可不定义;
}
}
]
});
this.bindEvents();
},
bindEvents: function() {
var home = mui('#home')[0];
home.addEventListener('tap', this.addHomeView.bind(this));
var journalism = mui('#journalism')[0];
journalism.addEventListener('tap', this.addJournalismView.bind(this));
var shoppingcart = mui('#shoppingcart')[0];
shoppingcart.addEventListener('tap', this.addShoppingCartView.bind(this));
var my = mui('#my')[0];
my.addEventListener('tap', this.addMyView.bind(this));
},
addHomeView: function() {
plus.webview.getWebviewById('a1').show();
plus.webview.getWebviewById('a2').hide();
plus.webview.getWebviewById('a3').hide();
plus.webview.getWebviewById('a4').hide();
},
addJournalismView: function() {
plus.webview.getWebviewById('a1').hide();
plus.webview.getWebviewById('a2').show();
plus.webview.getWebviewById('a3').hide();
plus.webview.getWebviewById('a4').hide();
},
addShoppingCartView: function() {
plus.webview.getWebviewById('a1').hide();
plus.webview.getWebviewById('a2').hide();
plus.webview.getWebviewById('a3').show();
plus.webview.getWebviewById('a4').hide();
},
addMyView: function() {
plus.webview.getWebviewById('a1').hide();
plus.webview.getWebviewById('a2').hide();
plus.webview.getWebviewById('a3').hide();
plus.webview.getWebviewById('a4').show();
}
}
mui.plusReady(function() {
var page = new Page();
page.init();
});
上面是父页面js代码
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="css/mui.min.css" rel="stylesheet" />
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="mainlist.js"></script>
</body>
</html>
上面是子页面HTML
mui.plusReady(function() {
alert("1");
});
上面是子界面js文件代码,我想问一下为什么这个alert不能输出。
1 个回复
新生 - 慢慢进步的菜鸟
你导入js写了没有哦