🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# uniapp页面传参 **示例** ``` <pre class="calibre13">``` <span class="token6">//在起始页面跳转到test.vue页面并传递参数</span> uni<span class="token1">.</span><span class="token3">navigateTo</span><span class="token1">(</span><span class="token1">{</span> url<span class="token1">:</span> <span class="token4">'test?id=1&name=uniapp'</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> ``` ``` ``` <pre class="calibre14">``` <span class="token6">// 在test.vue页面接受参数</span> <span class="token2">export</span> <span class="token2">default</span> <span class="token1">{</span> onLoad<span class="token1">:</span> <span class="token2">function</span> <span class="token1">(</span>option<span class="token1">)</span> <span class="token1">{</span> <span class="token6">//option为object类型,会序列化上个页面传递的参数</span> console<span class="token1">.</span><span class="token3">log</span><span class="token1">(</span>option<span class="token1">.</span>id<span class="token1">)</span><span class="token1">;</span> <span class="token6">//打印出上个页面传递的参数。</span> console<span class="token1">.</span><span class="token3">log</span><span class="token1">(</span>option<span class="token1">.</span>name<span class="token1">)</span><span class="token1">;</span> <span class="token6">//打印出上个页面传递的参数。</span> <span class="token1">}</span> <span class="token1">}</span> ``` ```