看到一个帖子,但是不知道回复的什么意思,这边想继续咨询下(这是已经有的帖子http://ask.dcloud.net.cn/question/25309)
场景和上述的帖子场景一样
主页A:有几个入口,待付款,待发货,待收货,待评价等入口;
订单页面:上部有顶部滑动tab选项卡(基本上是搬得官方的):这边的部分代码如下:
mui.plusReady(function() {
var sData = plus.webview.currentWebview();
if(sData != null) {
if(sData.type != null) {
type = sData.type;
}
}
if(type == -1) {
document.getElementById("orders_all").className = "mui-control-item mui-
active";
// group.switchTab('orders_all.html');
} else if(type == 1) {
document.getElementById("orders_pendingpayment").className = "mui-
control-item mui-active";
// group.switchTab('orders_pendingpayment.html');
} else if(type == 2) {
document.getElementById("orders_shipmentpending").className = "mui-
control-item mui-active";
// group.switchTab('orders_shipmentpending.html');
} else if(type == 3) {
document.getElementById("orders_tobereceived").className = "mui-
control-item mui-active";
// group.switchTab('orders_tobereceived.html');
} else if(type == 4) {
document.getElementById("orders_pendingevaluation").className = "mui-
control-item mui-active";
// group.switchTab('orders_pendingevaluation.html');
} else if(type == 5) {
document.getElementById("orders_returngoods").className = "mui-control-
item mui-active";
// group.switchTab('orders_returngoods.html');
} else {
document.getElementById("orders_all").className = "mui-control-item mui-
active";
// group.switchTab('orders_all.html');
}
var accountId = 1;
var webview = plus.webview.currentWebview();
var group = new webviewGroup(webview.id, {
items: [{
id: "orders_all.html",
url: "orders_all.html",
extras: {
accountId: accountId
}
}, {
id: "orders_pendingpayment.html",
url: "orders_pendingpayment.html",
extras: {
accountId: accountId
}
}, {
id: "orders_shipmentpending.html",
url: "orders_shipmentpending.html",
extras: {
accountId: accountId
}
}, {
id: "orders_tobereceived.html",
url: "orders_tobereceived.html",
extras: {
accountId: accountId
}
}, {
id: "orders_pendingevaluation.html",
url: "orders_pendingevaluation.html",
extras: {
accountId: accountId
}
}, {
id: "orders_returngoods.html",
url: "orders_returngoods.html",
extras: {
accountId: accountId
}
}],
onChange: function(obj) {
var c = document.querySelector(".mui-control-item.mui-active");
if(c) {
c.classList.remove("mui-active");
}
document.querySelector(".mui-scroll .mui-control-item:nth-child(" +
(parseInt(obj.index) + 1) + ")").classList.add("mui-active");
}
});
mui(".mui-scroll").on("tap", ".mui-control-item", function(e) {
var wid = this.getAttribute("data-wid");
group.switchTab(wid);
});
});
中间那一坨很简单的就是手动设置对应type的标签active
这样写没有用,虽然顶部active了,但是内容还是主页的,请教各位大神帮忙解决下!