NavBar.vue 766 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <div class="nav-bar">
  3. <van-nav-bar
  4. :title="title || '标题'"
  5. :border="false"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. :style="[customStyle]"
  9. />
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: "NavBar",
  15. props: {
  16. title: String,
  17. backUrl: String,
  18. customStyle: {
  19. type: Object,
  20. default() {
  21. return {};
  22. },
  23. },
  24. },
  25. methods: {
  26. onClickLeft() {
  27. this.$router.push({ path: this.backUrl });
  28. },
  29. },
  30. };
  31. </script>
  32. <!-- Add "scoped" attribute to limit CSS to this component only -->
  33. <style scoped lang="scss">
  34. .nav-bar .van-nav-bar {
  35. background: $color-theme;
  36. /deep/ .van-nav-bar__title {
  37. color: #fff;
  38. }
  39. /deep/ .van-icon {
  40. color: #fff;
  41. }
  42. }
  43. </style>