title: VueJS - v-if and v-show don't work properly
body: <p>I have this structure inside Vue DIV:</p>
  
  <pre><code>            &lt;div class="row"&gt;
                  &lt;div class="well chart-container"&gt;
                      &lt;div id="chart" v-if="chartShown"&gt;&lt;/div&gt;
                      &lt;h1 v-if="textShown"&gt;{{staticPropertyValue}}&lt;/h1&gt;
                  &lt;/div&gt;            
              &lt;/div&gt;
  </code></pre>
  
  <p>In my application I'd like to be able to display chart div OR h1 tag. Here's a part of my javaScript:</p>
  
  <pre><code>app.textShown = false;
  app.chartShown = true;
  
  if (data.length == 0) {
      MG.data_graphic({
          title: "Missing Data",
          description: "",
          error: 'No data',
          chart_type: 'missing-data',
          missing_text: 'There is no data',
          target: '#chart',
          full_width: true,
          height: 600
      });
  
      return;
  };
  
  if (data.length == 1) {
      app.staticPropertyValue = data[0].value;
      app.chartShown = false;
      app.textShown = true;
      return;
  }
  
  console.log('DRAWING GRAPH');
  console.log(document.getElementById('chart'));
   MG.data_graphic({
      title: "Fetched data",
      description: "",
      data: data,
      full_width: true,
      height: 600,
      target: '#chart',
      x_accessor: 'time',
      y_accessor: 'value'
  });
  </code></pre>
  
  <p>So, depending on data.length property, the chart is shown or h1 tag is shown. The problem appears, when I first time call above code and display h1 tag (because data.length == 1) and then next time I call it with date.length > 1 (chart should appear). I get error:</p>
  
  <blockquote>
    <p>The specified target element "#chart" could not be found in the page.
    The chart will not be rendered.</p>
  </blockquote>
  
  <p>It is from the library that I'm using for drawing charts - metricsgraphics.js.
  So I console logged the result of </p>
  
  <pre><code>document.getElementById('chart')
  </code></pre>
  
  <p>and it was <em>null</em>. So it means that although i switch chartShown to true, it's not done fast enough. How can I fix this?</p>
  
  <p>I also tried using v-show instead of v-if - didn't work well - I had some errors about the width of some elements being NaN.</p>