appointment-search-bar.js 906 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Vue.component('appointment-search-bar', {
  2. template: '<div class="clearfix">\
  3. <div id="searchPhone" class="pl15 dataCell form-group c-position-r">\
  4. <input id="kw" v-model="keyword" placeholder="输入社保卡或身份证号码" @blur="search" @keyup.13="search" class="form-control inline w260 ml5 pr30" type="text" >\
  5. </div></div>',
  6. props: ["card"],
  7. data: function() {
  8. return {
  9. keyword: "",
  10. idCard:''
  11. }
  12. },
  13. watch: {
  14. card(val){
  15. this.keyword = val
  16. this.search()
  17. }
  18. },
  19. mounted: function() {
  20. var vm = this;
  21. EventBus.$on("show-search", function() {
  22. vm.isShow = true
  23. })
  24. },
  25. methods: {
  26. search: function(event) {
  27. if(event && event.type =="keydown" && event.keyCode != 13 || this.keyword.length <= 0) {
  28. return
  29. }
  30. var kw = document.getElementById("kw")
  31. kw.blur()
  32. EventBus.$emit("appointment-search",{
  33. data: {"keyword": this.keyword}
  34. })
  35. }
  36. }
  37. })