back.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="page">
  3. <view class="flex-sub">
  4. <view class="back " @click="back()">
  5. <text class="cuIcon-back" style="color: #FFFFFF;"></text>
  6. </view>
  7. </view>
  8. <view class="title flex-sub" v-if="title">
  9. <text :style="titleStyle">{{title}}</text>
  10. </view>
  11. <view class="flex-sub">
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: "back",
  18. props: {
  19. title:{
  20. type: String,
  21. default: ''
  22. },
  23. titleStyle: {
  24. type: String,
  25. default: 'color: #fff;font-size: 32rpx;'
  26. }
  27. },
  28. data() {
  29. return {
  30. };
  31. },
  32. methods: {
  33. back() {
  34. uni.navigateBack({
  35. delta: 1
  36. })
  37. },
  38. }
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .flex-sub {
  43. flex: 1;
  44. }
  45. .title {
  46. text-align: center;
  47. display: flex;
  48. justify-content: center;
  49. align-items: center;
  50. }
  51. .page {
  52. position: fixed;
  53. width: 100%;
  54. top: var(--status-bar-height);
  55. margin-top: var(--status-bar-height);
  56. z-index: 99999;
  57. transition: top .25s;
  58. display: flex;
  59. width: 100%;
  60. }
  61. .back {
  62. margin-left: 20rpx;
  63. width: 60rpx;
  64. height: 60rpx;
  65. border-radius: 50%;
  66. background-color: rgba(0, 0, 0, .2);
  67. display: flex;
  68. justify-content: center;
  69. align-items: center;
  70. }
  71. </style>