list-navbar.vue 2.2 KB

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