huangyinfeng
2024-09-18 ccfd07feeaa670a3d56548d7fea0936e299df95b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<template>
  <div>
    <PageIndex :pageList="pageList" :mailType='1'></PageIndex>
  </div>
</template>
 
<script lang="ts" setup>
  name: 'Inbox';
  import { ref, onMounted, computed, provide } from 'vue';
  import PageIndex from '@/views/email/components/ListPage/list.vue';
  import { useRoute } from 'vue-router';
 
  const route = useRoute();
  // 获取当前完整 URL
  const routerId = computed(() => {
    try {
      const url = window.location.href;
      if (!url) {
        throw new Error('Invalid URL');
      }
      const basePart = url.split('?')[1];
      console.log(basePart, 'basePart');
      return basePart;
    } catch (error) {
      console.error('Error processing URL:', error);
      // 返回默认值或空字符串
      return '';
    }
  });
  import { getMailListApi } from '@/api/email/userList';
  const pageList = ref([]);
  function getDataList() {
    getMailListApi({ mail: routerId.value,mailType:1,isNoRead:true }).then((res) => {
      if (res.code == 0) {
        pageList.value = res.data;
      }
    });
  }
  provide('getDataList',getDataList);
  onMounted(() => {
    getDataList();
  });
</script>
<style scoped lang="less"></style>