c html页面一直在加载页面,ios 在 index.html 页面中调用模板加载方法, 然后Object-c 的回调就不起作用了...

在 index.html 页面中调用了这个方法, 然后回调就不起作用了(注释掉tinit方法,有正确返回), 代码如下:

mui.init({

swipeBack: false

});

tinit();

document.addEventListener("plusready", function(){

domindPlugin.checkTester();

});

domindPlugin.checkTester();方法请参考:

http://ask.dcloud.net.cn/question/5509?notification_id-24924rf-falseitem_id-9085__answer_id-9085__single-TRUE#!answer_9085

//以下为js中的代码

function initTemplates() {

getTemplate('default', '../templates/template.html');

};

//初始化模板

function tinit(){

mui.plusReady(function() {

//关闭splash页面;

plus.navigator.closeSplashscreen();

//初始化模板

//延迟加载的原因:等待index页面先创建menu和mask,这样就可以保证页面的zindex顺序;

setTimeout(function() {

initTemplates(); //预加载所有模板

}, 300);

});

}

var templates = {};

function getTemplate(name, header, content, loading) {

var template = templates[name];

if (!template) {

//alert('template');

//预加载共用父模板;

var headerWebview = mui.preload({

url: header,

id: name + "-main",

styles: {

popGesture: "hide",

zindex: 2

},

extras: {

mType: 'main'

}

});

//预加载共用子webview

var subWebview = mui.preload({

url: !content ? "" : content,

id: name + "-sub",

styles: {

top: '72px',

bottom: '0px',

zindex: 2

},

extras: {

mType: 'sub'

}

});

//loaded 页面加载完成后显示

subWebview.addEventListener('loaded', function() {

setTimeout(function() {

subWebview.show();

}, 50);

});

subWebview.hide();

headerWebview.append(subWebview);

//iOS平台支持侧滑关闭,父窗体侧滑隐藏后,同时需要隐藏子窗体;

if (mui.os.ios) { //5+父窗体隐藏,子窗体还可以看到?不符合逻辑吧?

headerWebview.addEventListener('hide', function() {

subWebview.hide("none");

});

}

templates[name] = template = {

name: name,

header: headerWebview,

content: subWebview,

loaded: loading

};

}

return template;

};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值