我在android react native项目工作,我得到了深度链接的URL。我试图从以下URL中找到路径名和搜索参数:https://test.xxx.com/test/test?test=moduleName .
var url = URL(“https://test.xxx.com/test/test?test=moduleName“);console.log(url.pathName);
代码给出以下异常“错误:未实现”。我也从节点安装了URL包。我缺少了什么?
我在android react native项目工作,我得到了深度链接的URL。我试图从以下URL中找到路径名和搜索参数:https://test.xxx.com/test/test?test=moduleName .
var url = URL(“https://test.xxx.com/test/test?test=moduleName“);console.log(url.pathName);
代码给出以下异常“错误:未实现”。我也从节点安装了URL包。我缺少了什么?
2条答案
按热度按时间g6baxovj1#
看看这个URL polyfill for React Native:
另外请注意-React Native runs within the JavascriptCore engine,而Node.js/Web在v8 Javascript引擎中运行。
Node.js提供了自己的专有功能- streams,crypto,http等。此功能在React Native中不可用,如node-libs-react-native等第三方包
q3qa4bjr2#
您可以使用此函数获取url参数,而无需任何库