full-webview-page.uvue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="background">
  3. <view class="container">
  4. <view class="nav">
  5. <view class="left_content">
  6. <text class="left_icon" @click="onBack()">{{backIcon}}</text>
  7. </view>
  8. <view class="title_content">
  9. <text class="title">{{title}}</text>
  10. </view>
  11. </view>
  12. <web-view class="web_container" :src="url"></web-view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. url: '',
  21. title: '',
  22. animationType: 'slide-out-bottom',
  23. backIcon: '\ue601'
  24. }
  25. },
  26. onLoad(options : OnLoadOptions) {
  27. this.url = options["url"] as string;
  28. this.title = options["title"] as string;
  29. this.animationType = options["animationType"] as string;
  30. },
  31. methods: {
  32. onBack() {
  33. uni.closeDialogPage({
  34. dialogPage: this.$page,
  35. animationType: this.animationType,
  36. success(res) {
  37. console.log('closeThisDialog success', res)
  38. },
  39. fail(err) {
  40. console.log('closeThisDialog fail', err)
  41. }
  42. })
  43. }
  44. }
  45. }
  46. </script>
  47. <style>
  48. .background {
  49. background-color: #007aff;
  50. width: 100%;
  51. height: 100%;
  52. }
  53. .nav {
  54. height: 45px;
  55. width: 100%;
  56. position: relative;
  57. flex-direction: row;
  58. justify-content: space-between;
  59. height: 45px;
  60. }
  61. .left_content {
  62. justify-content: center;
  63. align-items: center;
  64. width: 40px;
  65. height: 100%;
  66. }
  67. .left_icon {
  68. color: white;
  69. top: 5px;
  70. height: 100%;
  71. font-family: uni-icon;
  72. font-size: 26px;
  73. }
  74. .title_content {
  75. position: absolute;
  76. height: 100%;
  77. top: 0;
  78. bottom: 0;
  79. left: 45px;
  80. right: 45px;
  81. flex-direction: row;
  82. justify-content: center;
  83. align-items: center;
  84. }
  85. .title {
  86. color: white;
  87. font-size: 17px;
  88. }
  89. .container {
  90. padding-top: var(--status-bar-height);
  91. width: 100%;
  92. position: absolute;
  93. height: 100%;
  94. }
  95. .web_container {
  96. background-color: #f1f1f1;
  97. padding-top: 10px;
  98. flex: 1;
  99. width: 100%;
  100. }
  101. </style>