初始化历史搜索时机

This commit is contained in:
luchenqun 2017-05-05 10:14:04 +08:00
parent 3e917ca341
commit c2d42d97d2
2 changed files with 5 additions and 12 deletions

View File

@ -205,18 +205,6 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
bookmarkService.userInfo({}) bookmarkService.userInfo({})
.then((data) => { .then((data) => {
$scope.searchHistory = JSON.parse(data.search_history || '[]'); $scope.searchHistory = JSON.parse(data.search_history || '[]');
var count = 1;
var id = setInterval(function() {
var items = $('.search-item').popup({
on: 'focus',
inline: true
});
console.log("searchHistory = ", items.length, JSON.stringify(data.search_history));
count++;
if (items.length >= 1 || count >= 20) {
clearInterval(id);
}
}, 200);
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);

View File

@ -177,6 +177,11 @@ app.directive('jsMenuInit', function($compile) {
$('.ui.menu a.item').on('click', function() { $('.ui.menu a.item').on('click', function() {
$(this).addClass('selected').siblings().removeClass('selected'); $(this).addClass('selected').siblings().removeClass('selected');
}); });
$('.search-item').popup({
on: 'focus',
inline: true
});
} }
}, },
}; };