list-navbar.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <su-fixed
  3. alway
  4. :bgStyles="{ background: '#fff' }"
  5. :val="0"
  6. noNav
  7. :opacity="false"
  8. placeholder
  9. index="10090"
  10. >
  11. <su-status-bar />
  12. <view
  13. class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20"
  14. :style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
  15. >
  16. <!-- 左 -->
  17. <view class="left-box">
  18. <text
  19. class="_icon-back back-icon"
  20. @tap="toBack"
  21. :style="[{ color: state.iconColor }]"
  22. ></text>
  23. </view>
  24. <!-- 中 -->
  25. <uni-search-bar
  26. class="ss-flex-1"
  27. radius="33"
  28. :placeholder="placeholder"
  29. cancelButton="none"
  30. :focus="true"
  31. v-model="state.searchVal"
  32. @confirm="onSearch"
  33. />
  34. <!-- 右 -->
  35. <view class="right">
  36. <text class="sicon-more" :style="[{ color: state.iconColor }]" @tap="showMenuTools" />
  37. </view>
  38. <!-- #ifdef MP -->
  39. <view :style="[capsuleStyle]"></view>
  40. <!-- #endif -->
  41. </view>
  42. </su-fixed>
  43. </template>
  44. <script setup>
  45. import { reactive } from 'vue';
  46. import sheep from '@/sheep';
  47. import { showMenuTools } from '@/sheep/hooks/useModal';
  48. const sys_statusBar = sheep.$platform.device.statusBarHeight;
  49. const sys_navBar = sheep.$platform.navbar;
  50. const capsuleStyle = {
  51. width: sheep.$platform.capsule.width + 'px',
  52. height: sheep.$platform.capsule.height + 'px',
  53. margin: '0 ' + (sheep.$platform.device.windowWidth - sheep.$platform.capsule.right) + 'px',
  54. };
  55. const state = reactive({
  56. iconColor: '#000',
  57. searchVal: '',
  58. });
  59. const props = defineProps({
  60. placeholder: {
  61. type: String,
  62. default: '搜索内容',
  63. },
  64. });
  65. const emits = defineEmits(['searchConfirm']);
  66. // 返回
  67. const toBack = () => {
  68. sheep.$router.back();
  69. };
  70. // 搜索
  71. const onSearch = () => {
  72. emits('searchConfirm', state.searchVal);
  73. };
  74. const onTab = (item) => {};
  75. </script>
  76. <style lang="scss" scoped>
  77. .back-icon {
  78. font-size: 40rpx;
  79. }
  80. .sicon-more {
  81. font-size: 48rpx;
  82. }
  83. </style>