You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.6 KiB

4 years ago
  1. <template>
  2. <view class="app">
  3. <web-view :src="url"></web-view>
  4. <!-- #ifdef H5 -->
  5. <view class="back-btn center" @click="navBack">
  6. <text class="mix-icon icon-fanhui"></text>
  7. </view>
  8. <!-- #endif -->
  9. </view>
  10. </template>
  11. <script>
  12. let BackBtn = null;
  13. export default {
  14. data() {
  15. return {
  16. url: ''
  17. }
  18. },
  19. onLoad(options) {
  20. this.url = options.url;
  21. },
  22. // #ifdef APP-PLUS
  23. onReady() {
  24. this.createBackBtn();
  25. },
  26. onUnload() {
  27. BackBtn.close();
  28. },
  29. // #endif
  30. methods: {
  31. createBackBtn(){
  32. BackBtn = new plus.nativeObj.View('BackBtn', {
  33. bottom: '50px',
  34. left: uni.upx2px(640) + 'px',
  35. width: uni.upx2px(80) + 'px',
  36. height: uni.upx2px(80) + 'px',
  37. backgroundColor: 'rgba(0,0,0,0)',
  38. position:'absolute'
  39. })
  40. BackBtn.draw([{
  41. tag: 'img',
  42. id: 'backicon',
  43. src: '/static/icon/back-btn.png',
  44. position: {
  45. top: '0px',
  46. left: '0px',
  47. width: uni.upx2px(80) + 'px',
  48. height: uni.upx2px(80) + 'px',
  49. }
  50. }])
  51. BackBtn.show();
  52. BackBtn.addEventListener('click', ()=>{
  53. this.navBack();
  54. },false)
  55. },
  56. navBack(){
  57. uni.navigateBack();
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .back-btn{
  64. position: fixed;
  65. right: 30rpx;
  66. bottom: 100rpx;
  67. z-index: 9999;
  68. width: 80rpx;
  69. height: 80rpx;
  70. border-radius: 200rpx;
  71. background: linear-gradient(to right top, #db2b36, #fa725d);
  72. /* box-shadow: 2rpx 2rpx 10rpx rgba(228,63,66,.65) */
  73. }
  74. .icon-fanhui{
  75. font-size: 48rpx;
  76. color: #fff;
  77. }
  78. </style>