the following vue components:
<template>
<div class="parent">
<canvas ref="canvas2" ></canvas>
</div>
</template>
<script type="text/ecmascript-6">
export default {
methods: {
writeFont(){
var canvas = this.$refs.canvas2;
var ctx = canvas.getContext("2d");
ctx.font = "24px Arial";
ctx.fillStyle = "-sharp333333";
ctx.fillText("", 20, 20);
}
}
}
</script>
how to have the writeFont method execute when the component loads instead of binding it to a tag.