当前位置: 首页> 文旅> 文化 > 免费查公司查老板_个人网站备案多少钱_网页模版_app拉新推广平台渠道商

免费查公司查老板_个人网站备案多少钱_网页模版_app拉新推广平台渠道商

时间:2025/7/28 17:38:43来源:https://blog.csdn.net/u010465417/article/details/144171770 浏览次数:0次
免费查公司查老板_个人网站备案多少钱_网页模版_app拉新推广平台渠道商

1.  router -> index.ts 文件:

import { createRouter, createWebHistory } from 'vue-router'
import DefaultView from '@/views/default/index.vue'
import ParentView from '@/views/parent/index.vue'
import ChildView from '@/views/child/index.vue'const router = createRouter({history: createWebHistory(import.meta.env.BASE_URL),routes: [{path: '/',name: 'Default',component: DefaultView},{path: '/parent',name: 'parent',component: ParentView,children: [{path: 'child',name: 'child',component: ChildView}]}]
})export default router

2、父路由 ParentView 对应的 index.vue 界面

<template><div><span>父路由界面</span><!-- 下面 route-view 是子路由承载标签 --><router-view></router-view></div>
</template>
<script setup lang="ts">
import { onMounted, provide } from 'vue'//使用 provide 方法向子路由公开 CallParent 方法
provide('CallParent', (data: any) => {console.log('成功调用了父路由方法');
})onMounted(() => {//父路由界面元素加载完毕
})
</script>

3、子路由 ChildView 对应的 index.vue 界面

<template><div><span>子路由界面</span></div>
</template>
<script setup lang="ts">
import { onMounted, inject } from 'vue'//使用 inject 获取到父路由公开 CallParent 方法
let parentMethod: (data: any) => {} = inject('CallParent')onMounted(() => {//调用父路由中的方法parentMethod('hello world!')
})
</script>

关键字:免费查公司查老板_个人网站备案多少钱_网页模版_app拉新推广平台渠道商

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: