title: addEventListener 'message' return event.data undefined in VUE
body: <p>I want to send data from an html to an iframe, the iframe contains the page in vue</p>
  
  <p>checkout.html</p>
  
  <pre><code>&lt;script type="text/javascript" src="/api/js"&gt;&lt;/script&gt;
  &lt;div class="container"&gt;
      &lt;button id="pay-button" onclick="opencheckout()" class="btn disabled"&gt;Checkout&lt;/button&gt;
      &lt;div id="checkoutContainer"&gt;&lt;/div&gt;
  &lt;/div&gt;    
  &lt;script&gt;
      function opencheckout() {
          var checkout_i = CulqiJS.openCheckout()
          document.getElementById('checkoutContainer').innerHTML = CulqiJS.openCheckout()
  
          if (checkout_i) {
            var iframe = document.getElementById('checkout_form')
            var msg = { text: 'Hola mundo'}
            iframe.contentWindow.postMessage(msg,'*')
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>my file .vue
  checkout.vue</p>
  
  <pre><code>&lt;template&gt;
    &lt;div class="container" ref="maincheckout"&gt;
      &lt;p&gt;test&lt;/p&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  &lt;script&gt;
    export default {  
      created () {
        window.addEventListener('message',receiveMessage, false);
        function receiveMessage (event) {
          console.log('event data: ', event)
        }
      }
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>And this is the js that builds iframe</p>
  
  <pre><code>var CulqiJS = {
    openCheckout: function (options) {
      return '&lt;iframe id="checkout_form" width="100%" height="340" src="/#/checkout" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;'
    }
  }
  </code></pre>
  
  <p>Now return that</p>
  
  <p><a href="https://i.stack.imgur.com/ygk4W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ygk4W.png" alt="enter image description here"></a></p>