canvasNavbar.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view>
  3. <!-- 自定义导航栏 -->
  4. <view class="navBarBox">
  5. <!-- 状态栏占位 -->
  6. <view class="statusBar"></view>
  7. <!-- 真正的导航栏内容 -->
  8. <view class="navBar" :style="{ min_height: statusBarHeight + 'px'}">
  9. <uni-icons @click="goBack()" type="arrow-left" color="#fff" size="30"></uni-icons>
  10. <view>画框参数设置</view>
  11. <image class="logo-image" ></image>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import UniIcons from "../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
  18. export default {
  19. components: { UniIcons },
  20. data() {
  21. return {
  22. src:"/static/images/left.jpg",
  23. // 状态栏高度
  24. statusBarHeight: 0,
  25. // 导航栏高度
  26. navBarHeight: 82 + 11,
  27. };
  28. },
  29. props: {},
  30. //第一次加载时调用
  31. created() {
  32. //获取手机状态栏高度
  33. this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
  34. }, methods: {
  35. goBack(){
  36. uni.navigateBack({
  37. delta: 2
  38. });
  39. },
  40. toLogin() {
  41. //跳转传参示例
  42. this.$Router.push({
  43. path: '/pages/login/login',
  44. query: {msg: '我要登录!'}
  45. });
  46. },
  47. toOrder() {
  48. //跳转传参示例
  49. this.$Router.push({
  50. path: '/pages/order/order',
  51. query: {msg: '前往订单!'}
  52. });
  53. }
  54. }
  55. }
  56. </script>
  57. <style>
  58. .navBarBox {
  59. width: 100vw;
  60. }
  61. .navBarBox .navBar {
  62. padding: 3rpx 25rpx;
  63. padding-bottom: 8rpx;
  64. color: white;
  65. width: 100%;
  66. display: flex;
  67. justify-content: space-between;
  68. align-items: center;
  69. background: black;
  70. flex-direction: row;
  71. }
  72. .navBarBox .navBar .logo-image {
  73. width: 16rpx;
  74. height: 16rpx;
  75. margin-right: 10rpx;
  76. }
  77. .button {
  78. padding: 4rpx 40rpx;
  79. border-radius: 5px;
  80. font-size: 16px;
  81. }
  82. .button:hover {
  83. background: #2b85e4;
  84. }
  85. </style>