index.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view>
  3. <!-- 正确使用 u-navbar 的具名插槽 -->
  4. <u-navbar :autoBack="true" :placeholder="true" v-hideNav>
  5. <template v-slot:center>
  6. <view class="slot-wrap">
  7. <text @click="handleBrandClick" class="brand">Hermes</text>
  8. <text class="divider">|</text>
  9. <text @click="handleModelClick" class="model">Birkin 30</text>
  10. <text class="divider">|</text>
  11. <text @click="handlePriceClick" class="price">¥125,000</text>
  12. </view>
  13. </template>
  14. <template v-slot:right>
  15. <view class="slot-right">
  16. <image src="/static/icons/plus.png" mode="scaleToFill" />
  17. <text>加一单</text>
  18. </view>
  19. </template>
  20. </u-navbar>
  21. <orderDetailNewView />
  22. </view>
  23. </template>
  24. <script>
  25. import orderDetailNewView from './components/orderDetailNewView.vue'
  26. export default {
  27. name: 'CustomNavbar',
  28. components: {
  29. orderDetailNewView
  30. },
  31. methods: {
  32. handleBrandClick() {
  33. console.log('点击了品牌')
  34. },
  35. handleModelClick() {
  36. console.log('点击了型号')
  37. },
  38. handlePriceClick() {
  39. console.log('点击了价格')
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped>
  45. .slot-wrap {
  46. display: flex;
  47. align-items: center;
  48. background-color: #fff;
  49. border-radius: 40rpx;
  50. padding: 10rpx 20rpx;
  51. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  52. }
  53. .brand {
  54. font-weight: bold;
  55. color: #333;
  56. font-size: 28rpx;
  57. }
  58. .divider {
  59. margin: 0 15rpx;
  60. color: #ddd;
  61. font-size: 28rpx;
  62. }
  63. .model {
  64. color: #666;
  65. font-size: 26rpx;
  66. }
  67. .price {
  68. color: blueviolet;
  69. font-weight: bold;
  70. font-size: 28rpx;
  71. }
  72. .slot-right {
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. justify-content: center;
  77. font-size: 20rpx;
  78. color: blueviolet;
  79. image {
  80. width: 30rpx;
  81. height: 30rpx;
  82. }
  83. }
  84. </style>