2 Star 0 Fork 0

李帅醒Plus / BestNewBee

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
router.js 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
李帅醒Plus 提交于 2017-01-17 17:04 . 爱先锋微信开发版上线
//路由
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();
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wcslb/BestNewBee.git
git@gitee.com:wcslb/BestNewBee.git
wcslb
BestNewBee
BestNewBee
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891