index2.vue 892 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <Port1 v-if="switchType == 'port'" />
  3. </template>
  4. <script setup lang="ts">
  5. import { onLoad } from '@dcloudio/uni-app';
  6. import { getSwitchPageParams } from '@/utils/public';
  7. import Port1 from '../plant/port/index.vue';
  8. const switchType = ref('');
  9. onLoad(() => {
  10. // 使用公共函数获取参数
  11. const params = getSwitchPageParams();
  12. if (params) {
  13. console.log('从store获取的参数:', params);
  14. // 示例:如果params包含用户信息
  15. if (params.type) {
  16. switchType.value = params.type;
  17. }
  18. // 示例:如果params包含跳转信息
  19. if (params.title) {
  20. console.log('页面标题:', params.title);
  21. }
  22. if (params.path) {
  23. console.log('目标路径:', params.path);
  24. }
  25. } else {
  26. console.log('未找到参数或参数已过期');
  27. }
  28. });
  29. </script>