Navbar.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div class="m-page-header">
  3. <h3>
  4. <span
  5. v-if="isGoBack == true || isGoBack == 'true'"
  6. class="glyphicon glyphicon-circle-arrow-left m-page-header-image"
  7. @click="goBack"
  8. />
  9. {{ title }}
  10. <div class="pull-right">
  11. <slot />
  12. </div>
  13. </h3>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. // eslint-disable-next-line
  19. name: 'Navbar',
  20. components: {
  21. },
  22. props: {
  23. // 是否需要返回按钮,true:需要返回按钮,false:不需要返回按钮
  24. 'isGoBack':{
  25. type: Boolean,
  26. default: false,
  27. },
  28. // 标题
  29. 'title':
  30. {
  31. type: String,
  32. default: '',
  33. },
  34. },
  35. data: function () {
  36. return {
  37. data: '',
  38. };
  39. },
  40. methods: {
  41. goBack: function () {
  42. history.back();
  43. },
  44. },
  45. };
  46. </script>
  47. <style scoped>
  48. .m-page-header {
  49. margin: 0px 5px 5px 0px;
  50. padding: 0px;
  51. border-bottom: 1px solid #eee;
  52. }
  53. .m-page-header h3 {
  54. margin: 0px;
  55. padding: 5px 0px 9px 0px;
  56. }
  57. .m-page-header-image {
  58. top: 4px;
  59. cursor: pointer;
  60. }
  61. </style>