Reputation: 35
I'm trying to build this simple app, but I always get this error
Uncaught ReferenceError: Vue is not defined.
<template>
<v-app>
<div id="example-1">
<v-btn v-on:click="counter += 1">Add 1</v-btn>
<p>The button above has been clicked {{ counter }} times.</p>
</div>
</v-app>
</template>
<script>
var example1 = new Vue({
el: '#example-1',
data: {
counter: 0
}
})
</script>
Upvotes: 1
Views: 3526
Reputation: 1229
Replace template
tag with the div
and add cdn
at least before </body>
tag:
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div>
<v-app>
<div id="example-1">
<button v-on:click="counter += 1">Add 1</button>
<p>The button above has been clicked {{ counter }} times.</p>
</div>
</v-app>
</div>
<script>
var example = new Vue({
el: '#example-1',
data: {
counter: 0
}
})
</script>
I replaced v-btn
with the button
just to show that it works.
Upvotes: 2