list-navbar.vue 2.1 KB

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