当前位置:网站首页>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
});
边栏推荐
- Notblank and notempty
- The third part of the construction of the defense system of offensive and defensive exercises is the establishment of a practical security system
- What professional classification does the application of Internet of things technology belong to
- Daily three questions 6.28
- Redis RDB snapshot
- Daily three questions 6.29
- 2022 crane driver (limited to bridge crane) examination questions and simulation examination
- 股票开户哪个证券公司最好,有安全保障吗
- 2021 RoboCom 世界机器人开发者大赛-高职组复赛
- Reproduction process and problems of analog transformer (ICLR 2022 Spotlight)
猜你喜欢

【ES实战】ES上的安全性运行方式

How to display real-time 2D map after rviz is opened
![[applet] realize the left and right [sliding] list through the scroll view component](/img/18/b1b4e9923782856143721dad84cbab.png)
[applet] realize the left and right [sliding] list through the scroll view component

Distance measurement - Hamming distance

2021 RoboCom 世界机器人开发者大赛-本科组初赛

Notblank and notempty

MT manager test skiing Adventure

ConcurrentSkipListMap——跳表原理

为什么PHP叫超文本预处理器

Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
随机推荐
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板
2021 robocom world robot developer competition - semi finals of higher vocational group
Matplotlib常用設置
ARP报文头部格式和请求流程
How to display real-time 2D map after rviz is opened
【.Net Core】程序相关各种全局文件
Matplotlib常用设置
from pip._ internal. cli. main import main ModuleNotFoundError: No module named ‘pip‘
The third part of the construction of the defense system of offensive and defensive exercises is the establishment of a practical security system
STM32F030F4驱动TIM1637数码管芯片
typescript枚举
Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
Distance measurement - Hamming distance
Leetcode (34) -- find the first and last positions of elements in a sorted array
Daily three questions 6.30 (2)
Depth first search and breadth first search of graph traversal
notBlank 和 notEmpty
What is mosaic?
纪念成为首个DAYUs200三方demo贡献者