Vue-chartjs: Chart does not render inside conditional

Created on 14 Apr 2017  路  5Comments  路  Source: apertureless/vue-chartjs

Expected Behavior

I have two "tabs" on a page controlled by a Vue.js conditional.

Each tab has a separate chart instance with separate data. I was expecting that both charts would render. If both charts are moved outside the conditionals, they work fine.

Actual Behavior

Only the first chart seems to render. Switching to the second tab does not render the second chart - just keeps displaying the first chart.

See reproduction here: http://codepen.io/anon/pen/zwxapE?editors=1010

Environment

  • vue.js version: 2.2.6
  • vue-chart.js version: 2.6.0
  • npm version: n/a

Most helpful comment

@timster
Check out my edited codepen

Check out Vue documents on conditional rendering. It's a subtle distinction, but if a div has multiple children like your case did, conditional rendering should be applied to an outer