title: Execute script from plain HTML in vue
body: <p>I'm fetching a plain HTML widget which contains a script tags from remote API to vuex store.
  To properly render this widget scripts needs to be executed.
  Inside vue component I'm doing it this way:</p>
  
  <pre><code>&lt;div v-html="widget" id="widget-container"&gt;&lt;/div&gt;
  
  
  computed: mapGetters(["widget"]), // getter returns string of plain HTML
      methods: {
          renderWidget () {
              let container = document.getElementById("widget-container")
              let scriptsTags = container.getElementsByTagName("script")
                  for (let i = 0; i &lt; scriptsTags.length; i++) {
                      let parentNode = scriptsTags[i].parentNode
                      let newScriptTag = document.createElement("script")
                      newScriptTag.type = "text/javascript"
                      newScriptTag.text = scriptsTags[i].text
                      parentNode.removeChild(scriptsTags[i])
                      parentNode.appendChild(newScriptTag)
                  }
              },
          }
  </code></pre>
  
  <p>It works perfectly if I assign this method to button click event or else, but not on </p>
  
  <pre><code>mounted () { 
      this.renderWidget()
  }
  </code></pre>
  
  <p>hook. Nothing happens.</p>
  
  <p>So how should I execute scripts after fetching?</p>