NavBar.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div>
  3. <div class="bg-color-red" style="height: 0; position:fixed; top: 0; width: 100%; z-index: 30;
  4. height: constant(safe-area-inset-top); height: env(safe-area-inset-top);"></div>
  5. <div
  6. class="bg-color-red"
  7. style="height: 0.7rem; position:fixed; z-index:999; top:0; width: 100%;
  8. top: constant(safe-area-inset-top); top: env(safe-area-inset-top);"
  9. >
  10. <div
  11. class=""
  12. style="width: 100%; display: flex; line-height: 0.7rem; font-size: 0.35rem;"
  13. >
  14. <div
  15. class="iconfont icon-xiangzuo"
  16. style="color: #FFFFFF; font-size: 0.35rem; padding-left: 10px;"
  17. @click="returns"
  18. ></div>
  19. <div
  20. style="color: #FFFFFF; font-weight: 400; flex: auto; text-align: center; padding-right: 30px;"
  21. >
  22. {{ titles }}
  23. </div>
  24. </div>
  25. </div>
  26. <div style="height: 0.7rem"></div>
  27. <div style="padding-top: 0;
  28. padding-top: constant(safe-area-inset-top); padding-top: env(safe-area-inset-top);"></div>
  29. </div>
  30. </template>
  31. <script>
  32. export default {
  33. name: "NavBar",
  34. props: {
  35. title: String,
  36. path: String
  37. },
  38. data: function() {
  39. return {
  40. titles: ""
  41. };
  42. },
  43. created: function() {
  44. if (this.title === undefined) {
  45. this.titles = this.$route.meta.title;
  46. } else {
  47. this.titles = this.title;
  48. }
  49. },
  50. methods: {
  51. returns: function() {
  52. if (this.path === undefined) {
  53. this.$router.back();
  54. } else {
  55. this.$router.push({ path: this.path });
  56. }
  57. }
  58. }
  59. };
  60. </script>
  61. <style></style>