💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
[TOC] ## 示例 ``` // 跳转到目的页面,打开新页面 Taro.navigateTo({ url: '/pages/page/path/name', }) // 跳转到目的页面,在当前页面打开 Taro.redirectTo({ url: '/pages/page/path/name', }) ``` ## 路由传参 ``` // 传入参数 id=2&type=test Taro.navigateTo({ url: '/pages/page/path/name?id=2&type=test', }) ``` 获取参数 ``` <template> <view className="index" /> </template> <script> import Taro from '@tarojs/taro' export default { created() { // 建议在页面初始化时把 getCurrentInstance() 的结果保存下来供后面使用, // 而不是频繁地调用此 API this.$instance = Taro.getCurrentInstance() }, mounted() { // 获取路由参数 console.log(this.$instance.router.params) // 输出 { id: 2, type: 'test' } }, } </script> ```