赞
踩
1.react native 向uniapp h5传值时,直接通过url传值
- <script setup>
- const getUrlParams = () => {
- const url = window.location.href
- if (!url) return
- let urlStr = url.split('?')[1]
- let obj = {}
- let paramsArr = urlStr.split('&')
- for (let i = 0, len = paramsArr.length; i < len; i++) {
- let arr = paramsArr[i].split('=')
- obj[arr[0]] = arr[1]
- }
- console.log(obj )
- }
- getUrlParams()
- </script>
2.uniapp 向 react native传值
- window.ReactNativeWebView.postMessage(
- JSON.stringify(
- { type: "jumpOutsideWebView", data: 'url' })
- )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。