| 123456789101112131415161718192021222324252627282930 |
- <template>
- <Port1 v-if="switchType == 'port'" />
- </template>
- <script setup lang="ts">
- import { onLoad } from '@dcloudio/uni-app';
- import { getSwitchPageParams } from '@/utils/public';
- import Port1 from '../plant/port/index.vue';
- const switchType = ref('');
- onLoad(() => {
- // 使用公共函数获取参数
- const params = getSwitchPageParams();
- if (params) {
- console.log('从store获取的参数:', params);
- // 示例:如果params包含用户信息
- if (params.type) {
- switchType.value = params.type;
- }
- // 示例:如果params包含跳转信息
- if (params.title) {
- console.log('页面标题:', params.title);
- }
- if (params.path) {
- console.log('目标路径:', params.path);
- }
- } else {
- console.log('未找到参数或参数已过期');
- }
- });
- </script>
|