当前位置:网站首页>Using uni simple router, dynamically pass parameters typeerror: cannot convert undefined or null to object
Using uni simple router, dynamically pass parameters typeerror: cannot convert undefined or null to object
2022-07-01 23:32:00 【itwangyang520】
Previous code :
this.$Router.push({
path: `/pages/workbench/index/index`,
query: {
list: list,
data_url: list.data_url
}
})
}
The modified code :
/* Be careful : Use router It's pit. , You can solve this problem in two ways : 1. You can query It uses encodeURIComponent(JSON.stringify(list)) To transmit parameters 2. You can use vuex To transmit parameters , It can also realize dynamic parameter transfer this.$store.commit('xxx', list) */
this.$Router.push({
path: `/pages/workbench/index/index`,
query: {
list: encodeURIComponent(JSON.stringify(list)),
data_url: list.data_url
}
})
I added it here encodeURIComponent(JSON.stringify(list)),
Data received
/* Be careful : Use router It's pit. , You can solve this problem in two ways : 1. Scheme 1 ( recommend ): You can query It uses encodeURIComponent(JSON.stringify(list)) To transmit parameters 2. Option two : You can use vuex To transmit parameters , It can also realize dynamic parameter transfer this.$store.commit('xxx', list) */
// Option two
// console.log(this.$store.state.limit)
// this.name = this.$store.state.limit.name == 'undefined' ? this.$store.state.limit.url : this.$store.state.limit.name
// this.data_url = this.$Route.query.data_url
// uni.setNavigationBarTitle({
// title: this.$store.state.limit.title
// });
// Scheme 1
this.name = this.$Route.query.list.name == 'undefined' ? this.$Route.query.list.url : this.$Route.query.list.name
this.data_url = this.$Route.query.data_url
uni.setNavigationBarTitle({
title: this.$Route.query.list.title
});
边栏推荐
- Is it safe to choose mobile phone for stock trading account opening in Shanghai?
- Postgresql源码(57)HOT更新为什么性能差距那么大?
- 认识--Matplotlib
- Door level modeling - after class exercises
- [LeetCode] 最后一个单词的长度【58】
- 上海炒股开户选择手机办理安全吗?
- Leetcode (34) -- find the first and last positions of elements in a sorted array
- 字典、哈希表、数组的概念
- Y53. Chapter III kubernetes from introduction to mastery -- ingress (26)
- [swoole Series 1] what will you learn in the world of swoole?
猜你喜欢
Paramètres communs de matplotlib
Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
Redis数据类型和应用场景
mt管理器测试滑雪大冒险
Linux基础 —— CentOS7 离线安装 MySQL
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
边缘计算概述
【必会】BM41 输出二叉树的右视图【中等+】
What category does the Internet of things application technology major belong to
Experience of practical learning of Silicon Valley products
随机推荐
2021 robocom world robot developer competition - semi finals of higher vocational group
Paramètres communs de matplotlib
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
Li Kou today's question -241 Design priorities for operational expressions
深度学习 | 三个概念:Epoch, Batch, Iteration
Three development trends of enterprise application from the perspective of the third technological revolution
mysql:insert ignore、insert和replace区别
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板
[leetcode] length of the last word [58]
MySQL binlog cleanup
Matplotlib common settings
写给当前及未来博士研究生一些建议整理分享
[micro service sentinel] @sentinelresource details
sql 优化
SWT/ANR问题--SWT 导致 kernel fuse deadlock
Redis data types and application scenarios
第六章 数据流建模
【.Net Core】程序相关各种全局文件
【必会】BM41 输出二叉树的右视图【中等+】
How to display real-time 2D map after rviz is opened