gui-header-leading.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view
  3. v-if="onlyBack"
  4. class="gui-header-leader"
  5. style="padding:0;">
  6. <view class="gui-header-leader-btns"
  7. hover-class="gui-tap">
  8. <text
  9. class="gui-header-leader-btns gui-block-text gui-icons gui-primary-color"
  10. hover-class="gui-tap"
  11. @tap="goback"
  12. :style="'text-align:left; '+buttonStyle">&#xe643;</text>
  13. </view>
  14. </view>
  15. <view
  16. v-else-if="onlyHome"
  17. style="padding:0;"
  18. class="gui-header-leader">
  19. <view
  20. class="gui-header-leader-btns"
  21. hover-class="gui-tap">
  22. <text
  23. class="gui-header-leader-btns gui-block-text gui-icons gui-primary-color"
  24. @tap="gohome"
  25. :style="'text-align:left; font-size:35rpx; '+ buttonStyle">&#xe63b;</text>
  26. </view>
  27. </view>
  28. <view
  29. v-else
  30. class="gui-header-leader gui-flex gui-rows gui-nowrap gui-align-items-center gui-header-buttons-bg gui-border-box"
  31. :style="bgStyle">
  32. <view class="gui-header-leader-btns"
  33. hover-class="gui-tap">
  34. <text
  35. class="gui-header-leader-btns gui-block-text gui-icons gui-header-buttons-color"
  36. @tap="gohome"
  37. :style="'font-size:35rpx; '+ buttonStyle">&#xe63b;</text>
  38. </view>
  39. <view
  40. style="margin-left:12rpx;"
  41. class="gui-header-leader-btns"
  42. hover-class="gui-tap">
  43. <text class="gui-header-leader-btns gui-block-text gui-icons gui-header-buttons-color"
  44. @tap="goback"
  45. :style="buttonStyle">&#xe643;</text>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default{
  51. name : "gui-header-leading",
  52. props : {
  53. homePage : {type:String , default:"/pages/index/index"},
  54. bgStyle : {type:String , default:""},
  55. buttonStyle : {type:String , default:""},
  56. onlyBack : {type:Boolean, default:false},
  57. onlyHome : {type:Boolean, default:false}
  58. },
  59. methods:{
  60. goback : function () {
  61. uni.navigateBack({delta:1});
  62. this.$emit('goback');
  63. },
  64. gohome : function () {
  65. if(this.homePage != ''){
  66. uni.switchTab({url:this.homePage});
  67. }
  68. this.$emit('gohome');
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped>
  74. .gui-header-leader{height:55rpx; border-radius:55rpx; overflow:hidden; padding:0 25rpx;}
  75. .gui-header-leader-btns{width:40rpx; line-height:55rpx; font-size:30rpx; text-align:center; margin:0rpx; overflow:hidden;}
  76. </style>