<div id="app">
  <canvas ref="canvas" height="200" width="200" />
</div>
new Vue({
  el: '#app',
  mounted () {
    const ctx = this.$refs.canvas.getContext('2d')
    ctx.fillStyle = 'rgb(200,0,0)'
    ctx.fillRect(10, 10, 55, 50)

    ctx.fillStyle = 'rgba(0, 0, 200, 0.5)'
    ctx.fillRect(30, 30, 55, 50)
  }
})
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.js