当前位置:网站首页>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
});
边栏推荐
- Reproduction process and problems of analog transformer (ICLR 2022 Spotlight)
- 力扣今日题-241. 为运算表达式设计优先级
- CADD course learning (3) -- target drug interaction
- 第六章 数据流建模
- PostgreSQL notes (10) dynamically execute syntax parsing process
- Zero foundation tutorial of Internet of things development
- What professional classification does the application of Internet of things technology belong to
- The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem
- 哈工大《信息内容安全》课程知识要点和难点
- 2021 robocom world robot developer competition - semi finals of higher vocational group
猜你喜欢
The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem
Notblank and notempty
What is mosaic?
MySQL binlog cleanup
Three development trends of enterprise application from the perspective of the third technological revolution
云信小课堂 | IM及音视频中常见的认知误区
Redis AOF log
De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
Commemorate becoming the first dayus200 tripartite demo contributor
[micro service sentinel] sentinel integrates openfeign
随机推荐
The third part of the construction of the defense system of offensive and defensive exercises is the establishment of a practical security system
notBlank 和 notEmpty
有没有一段代码,让你为人类的智慧所折服
2021 RoboCom 世界机器人开发者大赛-高职组复赛
CADD course learning (3) -- target drug interaction
上海炒股开户选择手机办理安全吗?
Airserver latest win64 bit personal screen projection software
第六章 数据流建模
13 MySQL-约束
openwrt 开启KV漫游
每日三题 6.28
Concepts of dictionary, hash table and array
小程序表单校验封装
Reproduction process and problems of analog transformer (ICLR 2022 Spotlight)
[must] bm41 output the right view of the binary tree [medium +]
Daily three questions 6.28
Huisheng Huiying 2022 intelligent, fast and simple video editing software
Material Design组件 - 使用BottomSheet展现扩展内容(一)
Is it safe to choose mobile phone for stock trading account opening in Shanghai?
使用uni-simple-router,动态传参 TypeError: Cannot convert undefined or null to object