<!-- pages/admin/webview/index.vue -->
<template>
  <view class="webview-container">
    <!-- #ifndef H5 -->
    <web-view :src="url" @load="onLoad" @message="onMessage"></web-view>
    <!-- #endif -->

    <!-- #ifdef H5 -->
    <iframe :src="url" style="width:100%;height:100vh;border:none;"></iframe>
    <!-- #endif -->
  </view>
</template>

<script setup>
import { ref } from 'vue';
import { onLoad as onPageLoad } from '@dcloudio/uni-app';

const url = ref('');

onPageLoad((options) => {
  if (options.url) {
    url.value = decodeURIComponent(options.url);
  }
});

const onLoad = (e) => {
  console.log('webview loaded', e);
};

const onMessage = (e) => {
  console.log('message from webview', e.detail.data);
};
function goUpPage() {
		uni.redirectTo({
			url: `/pages/admin/ShouYe/shouye`
		})
	}
</script>

<style>
.webview-container {
  width: 100%;
  height: 100vh;
}
</style>