index.vue 743 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <view v-if="params.url">
  3. <web-view :webview-styles="webviewStyles" :src="`${params.url}`"></web-view>
  4. </view>
  5. </template>
  6. <script setup>
  7. import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
  8. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance } from "vue";
  9. const props = defineProps({
  10. // 数据
  11. src: {
  12. type: [String],
  13. default: null,
  14. },
  15. });
  16. const data = reactive({
  17. params: {},
  18. webviewStyles: {
  19. progress: {
  20. color: "#FF3333",
  21. },
  22. },
  23. });
  24. const { params, webviewStyles } = toRefs(data);
  25. onLoad((event) => {
  26. params.value = event;
  27. if (event.title) {
  28. uni.setNavigationBarTitle({
  29. title: event.title,
  30. });
  31. }
  32. });
  33. </script>