From 6d488a1814a60a7534a13692d9dc1a0623a9e3d3 Mon Sep 17 00:00:00 2001 From: wanganxp Date: Wed, 21 Aug 2019 01:42:11 +0800 Subject: [PATCH] Update navigator.md --- docs/component/navigator.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/component/navigator.md b/docs/component/navigator.md index 55fecd4f..6b5311d8 100644 --- a/docs/component/navigator.md +++ b/docs/component/navigator.md @@ -26,8 +26,8 @@ |reLaunch|对应 uni.reLaunch 的功能|头条小程序不支持| |navigateBack|对应 uni.navigateBack 的功能| | -**注意** -- navigator-hover 默认为 {background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, ```` 的子节点背景色应为透明色。** +**注意** +- navigator-hover 默认为 {background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, ```` 的子节点背景色应为透明色。** - app-nvue 平台暂不支持 `` **示例** @@ -49,5 +49,26 @@ ``` +```javascript +// navigate.vue页面接受参数 +export default { + onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数 + console.log(option.id); //打印出上个页面传递的参数。 + console.log(option.name); //打印出上个页面传递的参数。 + } +} +``` + +url有长度限制,太长的字符串会传递失败,可使用[窗体通信](https://uniapp.dcloud.io/collocation/frame/communication)、[全局变量](https://ask.dcloud.net.cn/article/35021),或`encodeURIComponent`等多种方式解决,如下为`encodeURIComponent`示例。 +```html + +``` +```javascript +// navigate.vue页面接受参数 +onLoad: function (option) { + const item = JSON.parse(decodeURIComponent(option.item)); +} +``` + **注意** -- 跳转tabbar页面,必须设置open-type="switchTab" \ No newline at end of file +- 跳转tabbar页面,必须设置open-type="switchTab" -- GitLab