Vue.component('appointment-search-bar', { template: '
\
\ \
', props: ["card"], data: function() { return { keyword: "", idCard:'' } }, watch: { card(val){ this.keyword = val this.search() } }, mounted: function() { var vm = this; EventBus.$on("show-search", function() { vm.isShow = true }) }, methods: { search: function(event) { if(event && event.type =="keydown" && event.keyCode != 13 || this.keyword.length <= 0) { return } var kw = document.getElementById("kw") kw.blur() EventBus.$emit("appointment-search",{ data: {"keyword": this.keyword} }) } } })