代码拉取完成,页面将自动刷新
//路由
define(["backbone"],function(){
var router=Backbone.Router.extend({
routes:{
//key:value key 是路由值(访问路径里#后的值) value 是对应的处理函数名
"home":"home",
"delivery":"delivery",
"reserve":"reserve",
"shopCar":"shopCar",
"center":"center",
"order":"order",
"integral":"integral",
"seckill":"seckill",
"search":"search",
"location":"location"
},
//这里的home对应上面的value
home:function(){
console.log("跳转到home");
require(["modules/home/home"],function(h){
h.render();
});
},
delivery:function(){
console.log("跳转到闪送");
require(["modules/delivery/delivery"],function(h){
h.render();
})
},
reserve:function(){
console.log("跳转新鲜预定");
require(["modules/reserve/reserve"],function(h){
h.render();
})
},
shopCar:function(){
console.log("跳转购物车");
require(["modules/shopCar/shopCar"],function(h){
h.render();
})
},
center:function(){
console.log("跳转个人中心");
require(["modules/center/center"],function(h){
h.render();
})
},
order:function(){
console.log("跳转订单");
require(["modules/order/order"],function(h){
h.render();
})
},
integral:function(){
console.log("跳转积分");
require(["modules/integral/integral"],function(h){
h.render();
})
},
seckill:function(){
console.log("跳转秒杀");
require(["modules/seckill/seckill"],function(h){
h.render();
})
},
search:function(){
console.log("跳转搜索");
require(["modules/search/search"],function(h){
h.render();
})
},
location:function(){
console.log("跳转搜索");
require(["modules/location/location"],function(h){
h.render();
})
}
});
new router();
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。