2👍
✅
Your scripts are in incorrect order. You have to include Vue.js first, then your script as second, because your script references Vue
object, which is defined in vue.js
.
Also, while vue.js
can be included in <head>
, your Vue model definition should go into the <body>
tag, after the target element, otherwise, it will not work.
<head>
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
</head>
<body>
<div id="test">...</div>
<script src="test.js"></script>
</body>
Source:stackexchange.com