navbar-item.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view class="ss-flex ss-col-center">
  3. <view
  4. v-if="data.type === 'text'"
  5. class="nav-title inline"
  6. :style="[{ color: data.textColor, width: width }]"
  7. >
  8. {{ data.text }}
  9. </view>
  10. <view
  11. v-if="data.type === 'image'"
  12. :style="[{ width: width }]"
  13. class="menu-icon-wrap ss-flex ss-row-center ss-col-center"
  14. @tap="sheep.$router.go(data.url)"
  15. >
  16. <image class="nav-image" :src="sheep.$url.cdn(data.src)" mode="aspectFit"></image>
  17. </view>
  18. <view class="ss-flex-1" v-if="data.type == 'search'" :style="[{ width: width }]">
  19. <s-search-block
  20. :placeholder="data.placeholder || '搜索关键字'"
  21. :radius="data.borderRadius"
  22. elBackground="#fff"
  23. :height="height"
  24. :width="width"
  25. @click="sheep.$router.go('/pages/index/search')"
  26. ></s-search-block>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import sheep from '@/sheep';
  32. import { computed } from 'vue';
  33. // 接收参数
  34. const props = defineProps({
  35. data: {
  36. type: Object,
  37. default: () => ({}),
  38. },
  39. width: {
  40. type: String,
  41. default: '1px',
  42. },
  43. });
  44. const height = computed(() => sheep.$platform.capsule.height);
  45. </script>
  46. <style lang="scss" scoped>
  47. .nav-title {
  48. font-size: 36rpx;
  49. color: #333;
  50. text-align: center;
  51. }
  52. .menu-icon-wrap {
  53. .nav-image {
  54. height: 24px;
  55. }
  56. }
  57. </style>