navigation.vue 904 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view class="head-box" :style="{color:color,backgroundColor:backgroundColor}">
  3. <uni-icons type="back" size="25" :color="color" @click="navigateBack"></uni-icons>
  4. <text>{{title}}</text>
  5. <uni-icons type="home" size="25" :color="color" @click="handleToHome"></uni-icons>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: "back",
  11. props: {
  12. title: {
  13. type: String,
  14. },
  15. color: {
  16. type: String,
  17. default: '#fff'
  18. },
  19. backgroundColor: {
  20. type: String,
  21. default: '#2476f5'
  22. },
  23. },
  24. data() {
  25. return {};
  26. },
  27. methods: {
  28. navigateBack() {
  29. uni.navigateBack();
  30. },
  31. handleToHome() {
  32. uni.switchTab({
  33. url: '/pages/index/index'
  34. })
  35. },
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .head-box {
  41. height: 70rpx;
  42. padding: 20rpx;
  43. display: flex;
  44. justify-content: space-between;
  45. align-items: center;
  46. font-size: 34rpx;
  47. }
  48. </style>