title: toDataURL() does not show the image in vue 2
body: <p>I have graph in one component (turnout) that needs to be printed from a second component (all elections). I import the turnout component with the graph into the all elections turnout and give it a hidden class as I don´t want it lo appear when all elections component loads. I only want it to appear in the print window.
  The canvas element needs to be converted into an img, which can be done with toDataURL(). Unfortunately, when the img is created, it does not get any width and height, probaby because the component and image are hidden, therefore per toDataURL() specifications, I get  instead of the image that should be created. Help!</p>
  <p>this is the imported turnout component</p>
  <pre><code>&lt;turnout
          class=&quot;pas ba mtm hidden&quot;
          turnout-entity=&quot;electionEvent&quot;
          :entity-id=&quot;selectedElectionEvent.id&quot;
        /&gt;
  
  </code></pre>
  <p>this is the code when print in clicked:</p>
  <pre><code>onPrintClicked () {
        const printView = this.$el.cloneNode(true)
        printView.getElementsByClassName('flex-100 mtm pas ba hidden')[0].className = 'flex-100 mtm pas ba'
        const chartImageElement = this.getChartImageElement()
        setTimeout(() =&gt; {
          printView.getElementsByTagName('canvas')[0].replaceWith(chartImageElement)
          setTimeout(() =&gt; {
            this.$bus.$emit(busEvents.printComponent, {
              id: 'turnout',
              node: printView
            })
          }, 2000)
        }, 1000)
        console.log(chartImageElement)
      },
      getChartImageElement () {
        const chartImage = this.$el.getElementsByTagName('canvas')[0].toDataURL()
        const imageElement = document.createElement('img')
        imageElement.setAttribute('src', chartImage)
        return imageElement
      },
  </code></pre>
  <p>I end up with an empty img tag:</p>
  <p><a href="https://i.stack.imgur.com/IY20i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IY20i.png" alt="empty img tag" /></a></p>