onLoad((options : OnLoadOptions) => {
console.log('--onLoad', options)
if (options['url'] != null) {
//console.log('--d',typeof options)
url.value = decodeURIComponent(options['url']) as string
}
})
19:52:06.730 [plugin:uni:app-uts] 编译失败
19:52:06.730 error: 类型不匹配: 推断类型是String?(可为空的String),但预期的是String。
19:52:06.730 at pages/index/web.uvue:15:34
19:52:06.730 13 | if (options['url'] != null) {
19:52:06.730 14 | //console.log('--d',typeof options)
19:52:06.730 15 | url.value = decodeURIComponent(options['url']) as string
19:52:06.730 | ^
19:52:06.730 16 | }
19:52:06.730 17 | })
1 个回复
最佳回复
top10000 (作者)
url.value = decodeURIComponent(options['url'] as string) as string
已解决 改成上面的就行了 加个as string