I am using vue in the browser, code seems fine to me yet it is giving error saying "vue is not defined".
This itself is complete code.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="app">
{{ message }}
<line-chart></line-chart>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>
<script src="https://unpkg.com/vue-chartjs/dist/vue-chartjs.min.js"></script>
<script>
Vue.component('line-chart', {
extends: VueChartJs.Line,
mounted () {
this.renderChart({
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'Data One',
backgroundColor: '#f87979',
data: [40, 39, 10, 40, 39, 80, 40]
}
]
}, {responsive: true, maintainAspectRatio: false})
}
})
var vm = new Vue({
el: '.app',
data: {
message: 'Hello World'
}
})
</script>
</body>
</html>
This is sample one, though i am using it to plot real time data.
In html file just include Vue with
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
or:
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
and it works.