Answer the question
In order to leave comments, you need to log in
How to fix a bug in a Vue project?
Hello! Below is a piece of code
<template>
<div class="col-sm">
План составляет: {{tasks[0].title}}
<div id="chart">
</div>
</div>
</template>
<script>
export default {
data() {
return {
tasks: [],
},
mounted(){
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
</script>
Answer the question
In order to leave comments, you need to log in
If you are using querySelector in vue, you are most likely doing something wrong. In 99.9% of cases, you should use ref :
<template>
<div class="col-sm">
План составляет: {{tasks[0].title}}
<div ref="chart"></div>
</div>
</template>
<script>
export default {
data() {
return {
tasks: [],
};
},
mounted() {
var chart = new ApexCharts(this.$refs.chart, options);
chart.render();
},
};
</script>
Just learning ... but I have my suspicions)))
1. https://ru.vuejs.org/v2/api/#mounted
2. tasks: [{title: 'Default',}], Can write something to the array?
3. Code truncated ... syntax. Maybe you stuck mounted() in the wrong place.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question