bd-h5-back.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view @click="back" :class="iconStyle == 1 ? 'bd-back-style-1' : 'bd-back-style-2 cross-center main-center'" :style="{'height': iconStyle == 2 ? height + 'upx' : '46upx','width': iconStyle == 2 ? width + 'upx' : '46upx'}">
  3. <image class="back-icon" v-if="iconStyle == 2" :src="moreRank ? '../../../../static/image/icon/h5-back-2.png' : '../../../static/image/icon/h5-back-2.png'" alt=""></image>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. name: "bd-h5-back",
  9. props: {
  10. height: {
  11. type: String,
  12. default: function(){
  13. return '102';
  14. }
  15. },
  16. width: {
  17. type: String,
  18. default: function(){
  19. return '75';
  20. }
  21. },
  22. iconStyle: {
  23. type: Number,
  24. default: function(){
  25. return 1;
  26. }
  27. },
  28. moreRank: {
  29. type: Boolean
  30. }
  31. },
  32. methods: {
  33. back() {
  34. let pages = getCurrentPages();
  35. if (pages.length > 1) {
  36. uni.navigateBack();
  37. } else {
  38. uni.navigateTo({
  39. url: 'pages/index/index'
  40. });
  41. }
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .bd-back-style-1 {
  48. width: 46upx;
  49. border-radius: 50%;
  50. position: fixed;
  51. top: 24upx;
  52. left:24upx;
  53. z-index: 1500;
  54. background-repeat: no-repeat;
  55. background-image: url("../../../static/image/icon/h5-back.png");
  56. background-size: 100% 100%;
  57. }
  58. .bd-back-style-2 {
  59. border-radius: 50%;
  60. position: fixed;
  61. top: 0;
  62. left:0;
  63. z-index: 1500;
  64. .back-icon {
  65. width: 15upx;
  66. height: 27upx;
  67. }
  68. }
  69. </style>