web-view使用postMessage参数没有传递过去,是不是使用redirect组件不算销毁?
发布于 6 年前 作者 pengna 952 次浏览 来自 官方Issues

h5代码如下


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>Authoriztion Success</title>

</head>

<body>

    <div>Loading...</div>

    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>

    <script type="text/javascript">

         wx.miniProgram.postMessage({

             url:'123'

         })

        wx.miniProgram.redirectTo({

            url:'/pages/navigator/index/index'

        })

    </script>

</body>

</html>


    拿到数据如下 ,是空的

  1. currentTarget{dataset{…}id""offsetTop0offsetLeft0}

  2. detail:

    1. dataArray(1)

      1. 0:

        1. __proto__Object

      2. length1

      3. nv_length(...)

      4. __proto__Array(0)

    2. __proto__Object

  3. target{dataset{…}id""offsetTop0offsetLeft0}

  4. timeStamp18935

  5. type"message"

2 回复

好像

 wx.miniProgram.postMessage({ data:{data:data}})

要写在redirectTo后面

wx.miniProgram.reLaunch试试

回到顶部