1.目录
homework
add.html
online.html
offline.html
res
script
action
homework
add.js
2.add.html
<div class="main" bg-action="action/homework/add">
<ul class="b">
<li><a href="#{{urlArr[0]}}" bg-target="main" class="cur"><b class="icon icon-h-icon-20"></b>线上作业</a></li>
<li><a href="#{{urlArr[1]}}" bg-target="main"><b class="icon icon-h-icon-20"></b>线下作业</a></li>
</ul>
<div bg-name="main" bg-route="defaultUrl"></div>
</div>
3.add.js
bingo.action('homework/add', function ($view, $var, $model, homeworkSrv, commonSrv) {
console.log('homework/add', homeworkSrv);
$view.defaultUrl = '';
var urlArr = ['view/homework/online','view/homework/offline'];
for(i in urlArr){
if(location.href.indexOf(urlArr[i])>=0){
// $('.b li').eq(i).find('a').trigger('click');
$view.defaultUrl = urlArr[i];
// if(i!=0) $('body').animate({'scrollTop':$('.wrap-content').offset().top},1000);
break;
};
};
if(!$view.defaultUrl) $view.defaultUrl=urlArr[0];
$view.$update();
});