(function() { Vue.component('device-searchbar', { template: '
\ 居民/医生:\
\ \ \
\
', props: [], data: function() { return { name: null, isShow: false } }, methods: { search: function() { if(this.name) { EventBus.$emit('search-patient-info', { keyword: this.name }); } else { toastr.error("请输入关键字"); } } }, mounted: function() { var vm = this; //数据加载完成 EventBus.$on('data-load-complete', function(arg) { vm.isShow = true; }); $('#keyword').bind('keyup', function(event) { if(event.keyCode == "13") { //回车执行查询 vm.search(); } }); } }) })()