SearchTransparent.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div class="search-wrap">
  3. <button
  4. @click="onClickSearch"
  5. class="search"
  6. >
  7. <img class="icon" src="@/assets/img/service/search-white.png" alt="" draggable="false">
  8. </button>
  9. <input
  10. v-model.trim="keyword"
  11. maxlength="30"
  12. type="text"
  13. :placeholder="placeholder"
  14. @keydown.enter="onClickSearch"
  15. >
  16. </div>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. placeholder: {
  22. type: String,
  23. default: '请输入酒店名称',
  24. }
  25. },
  26. data() {
  27. return {
  28. keyword: '',
  29. }
  30. },
  31. methods: {
  32. onClickSearch() {
  33. this.$emit('search', this.keyword)
  34. },
  35. }
  36. }
  37. </script>
  38. <style lang="less" scoped>
  39. .search-wrap {
  40. height: 10.7vw;
  41. background: rgba(0, 0, 0, 0.65);
  42. border: 1px solid #FFFFFF;
  43. border-radius: 2.7vw;
  44. display: flex;
  45. align-items: center;
  46. font-size: 4.3vw;
  47. padding: 0 3.5vw;
  48. > button.search {
  49. flex: 0 0 auto;
  50. width: 4vw;
  51. height: 4vw;
  52. position: relative;
  53. margin-right: 2.1vw;
  54. > img.icon {
  55. position: absolute;
  56. left: 0;
  57. top: 0;
  58. width: 100%;
  59. height: 100%;
  60. }
  61. }
  62. > input {
  63. flex: 1 0 1px;
  64. height: 100%;
  65. color: #fff;
  66. }
  67. }
  68. </style>