search-bar.vue 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view>
  3. <!--disabled为false时 可以在搜索框输入内容 使用 @onSearch :disabled="false"-->
  4. <!--disabled为true时 默认为true 则是跳转到新页面进行搜索 使用 @onNavigator -->
  5. <view class="cu-bar bg-white search" @click="navNewPage">
  6. <view class="search-form radius">
  7. <text class="cuIcon-search"></text>
  8. <input v-model="textValue" :adjust-position="false" :disabled="disabled" :placeholder="placeholder"></input>
  9. </view>
  10. <view class="action" @click="searchItem(textValue)">
  11. <text>搜索</text>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: {
  19. disabled: {
  20. type: Boolean,
  21. default: true,
  22. },
  23. placeholder: {
  24. type: String,
  25. default: '请输入参赛选手名字'
  26. }
  27. },
  28. data() {
  29. return {
  30. textValue:'',
  31. }
  32. },
  33. methods:{
  34. navNewPage() {
  35. this.$emit('onNavigator');
  36. },
  37. searchItem(value) {
  38. this.$emit('onSearch',value);
  39. },
  40. }
  41. }
  42. </script>
  43. <style>
  44. </style>