fg-navbar.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script lang="ts" setup>
  2. withDefaults(
  3. defineProps<{
  4. leftText?: string
  5. rightText?: string
  6. leftArrow?: boolean
  7. bordered?: boolean
  8. fixed?: boolean
  9. placeholder?: boolean
  10. zIndex?: number
  11. safeAreaInsetTop?: boolean
  12. leftDisabled?: boolean
  13. rightDisabled?: boolean
  14. }>(),
  15. {
  16. leftText: '返回',
  17. rightText: '',
  18. leftArrow: true,
  19. bordered: true,
  20. fixed: false,
  21. placeholder: true,
  22. zIndex: 1,
  23. safeAreaInsetTop: true,
  24. leftDisabled: false,
  25. rightDisabled: false,
  26. },
  27. )
  28. function handleClickLeft() {
  29. uni.navigateBack({
  30. fail() {
  31. uni.reLaunch({
  32. url: '/pages/index/index',
  33. })
  34. },
  35. })
  36. }
  37. </script>
  38. <template>
  39. <wd-navbar
  40. :left-text="leftText"
  41. :right-text="rightText"
  42. :left-arrow="leftArrow"
  43. :bordered="bordered"
  44. :fixed="fixed"
  45. :placeholder="placeholder"
  46. :z-index="zIndex"
  47. :safe-area-inset-top="safeAreaInsetTop"
  48. :left-disabled="leftDisabled"
  49. :right-disabled="rightDisabled"
  50. @click-left="handleClickLeft"
  51. >
  52. <template #title>
  53. <slot />
  54. </template>
  55. </wd-navbar>
  56. </template>