search-nav.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="nav_content" :style="{height: height + 'rpx'}">
  3. <view class="container">
  4. <view class="container__content">
  5. <input class="container__content__input"
  6. v-model="search_content"
  7. placeholder="输入关键字"
  8. placeholder-class="#e9e9e9e"
  9. confirm-type="search"
  10. @input="onInput"
  11. @confirm="clickSearch"
  12. type="text" />
  13. <view class="container__content__btn" @click="clickSearch">搜索</view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script setup lang="ts">
  19. import { ref } from 'vue';
  20. defineProps({
  21. height:Number,
  22. })
  23. let search_content = ref('')
  24. const emits = defineEmits(['clickSearch'])
  25. function onInput() {
  26. // console.log('search_content',search_content.value)
  27. }
  28. function clickSearch() {
  29. emits('clickSearch',search_content.value)
  30. }
  31. </script>
  32. <style lang="scss">
  33. .nav_content{
  34. position: fixed;
  35. display: flex;
  36. flex-direction: column;
  37. width: 100%;
  38. left: 0;
  39. /* #ifdef H5 */
  40. top: 44px;
  41. /* #endif */
  42. background-color: #ffffff;
  43. border-bottom-width: 1rpx;
  44. border-bottom-style: solid;
  45. border-bottom-color: #eee;
  46. // background-color: purple;
  47. .container{
  48. display: flex;
  49. flex-direction: column;
  50. height: 100%;
  51. // background-color: yellow;
  52. &__content {
  53. display: flex;
  54. flex-direction: row;
  55. align-items: center;
  56. margin-left: 3%;
  57. height: 100%;
  58. // background-color: green;
  59. &__input {
  60. padding: 0 2%;
  61. width: 80%;
  62. height: 70%;
  63. border-radius: 5rpx;
  64. border: #eee solid 2rpx;
  65. // background-color: skyblue;
  66. }
  67. &__btn {
  68. display: flex;
  69. width: 15%;
  70. height: 100%;
  71. justify-content: center;
  72. align-items: center;
  73. // background-color: blue;
  74. }
  75. }
  76. }
  77. }
  78. </style>