我在使用搜索组件时遇到问题。
我想要做的是能够访问所选元素数据,但看起来存在一些计时问题和/或我以错误的方式做事。
这是我的代码:
$('.ui.search.popup-project-changeCustomer').search(
{
type : 'standard',
source : $scope.customers,
searchFields : [
'title',
'description'
],
onSelect : function(event) {
$scope.project.customer = event.target.value;
$scope.changeCustomer(token);
return 'default';
}
});
问题出在 onSelect 事件中,基本上我可以访问 target.value
但我得到的是用户输入的内容,而不是搜索组件放入输入中的内容。
实际获取用户所选元素的数据(如标题、描述等)的最佳实践是什么?我想我在这里做错了什么。
最佳答案
我知道这可能不是完整的答案,但可以在此处找到更多信息:https://github.com/Semantic-Org/Semantic-UI/issues/1634
我问了同样的问题,看起来这个问题将在 1.8.0 中得到解决。
关于javascript - 语义用户界面 : Access search component selected item,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27962177/