nav-bar.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view>
  3. <u-navbar :is-back="showBackBtn" :title="title" z-index="99999999999999">
  4. <view class="slot-wrap">
  5. <u-icon
  6. class="homeIcon"
  7. v-if="showHomeBtn"
  8. @click="goHome()"
  9. name="home"
  10. size="40"
  11. ></u-icon>
  12. </view>
  13. </u-navbar>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. name: "navBar",
  19. props: {
  20. statusBar: {
  21. type: Boolean,
  22. default: true,
  23. },
  24. title: {
  25. type: String,
  26. default: "",
  27. },
  28. showBackBtn: {
  29. type: Boolean,
  30. default: true,
  31. },
  32. showHomeBtn: {
  33. type: Boolean,
  34. default: true,
  35. },
  36. },
  37. components: {},
  38. data() {
  39. return {};
  40. },
  41. onLoad() {},
  42. created() {},
  43. mounted() {},
  44. onPageShow() {},
  45. methods: {
  46. goHome() {
  47. uni.switchTab({
  48. url: "/pages/index/index",
  49. });
  50. },
  51. },
  52. };
  53. </script>
  54. <style scoped lang="scss">
  55. .homeIcon {
  56. margin-left: 20rpx;
  57. }
  58. .slot-wrap {
  59. display: flex;
  60. align-items: center;
  61. }
  62. </style>