index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <u-navbar :titleStyle="{ color: '#fff' }" :autoBack="true" :title="params?.title" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
  3. <template #left>
  4. <view class="u-navbar__content__left__item">
  5. <u-icon name="arrow-left" size="20" color="#fff"></u-icon>
  6. </view>
  7. </template>
  8. <template #center>
  9. <view class="u-navbar__content__left__item" style="color:#fff">{{ state.title }}</view>
  10. </template>
  11. </u-navbar>
  12. <view v-if="params.url">
  13. <web-view :webview-styles="webviewStyles" :src="`${params.url}`" allow></web-view>
  14. </view>
  15. </template>
  16. <script setup>
  17. /*----------------------------------依赖引入-----------------------------------*/
  18. import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
  19. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance, toRefs } from "vue";
  20. /*----------------------------------接口引入-----------------------------------*/
  21. /*----------------------------------组件引入-----------------------------------*/
  22. /*----------------------------------store引入-----------------------------------*/
  23. import { useStores, commonStores } from "@/store/modules/index";
  24. /*----------------------------------公共方法引入-----------------------------------*/
  25. /*----------------------------------公共变量-----------------------------------*/
  26. const { proxy } = getCurrentInstance();
  27. const useStore = useStores();
  28. /*----------------------------------变量声明-----------------------------------*/
  29. const props = defineProps({
  30. // 数据
  31. src: {
  32. type: [String],
  33. default: null,
  34. },
  35. });
  36. const state = reactive({
  37. params: {},
  38. webviewStyles: {
  39. progress: {
  40. color: "#FF3333",
  41. },
  42. },
  43. // title:undefined
  44. });
  45. const { params, webviewStyles } = toRefs(state);
  46. onLoad((event) => {
  47. params.value = event;
  48. console.log(params._object.params.url)
  49. if(params._object.params.url.indexOf('login?token=') > 0){
  50. var name = '智慧办公系统(U8)'
  51. wx.setNavigationBarTitle({
  52. title: name
  53. });
  54. }
  55. state.title = name;
  56. });
  57. onShow(() => {
  58. //调用系统主题颜色
  59. proxy.$settingStore.systemThemeColor([1]);
  60. });
  61. </script>