0👍
✅
From opening https://cdn.jsdelivr.net/npm/vue
directly in a browser
Original file: /npm/vue@3.2.47/dist/vue.global.js
The CDN is for Vue 3, but the code you’re trying to run is specific to Vue 2. The actual Vue 2 docs specify an appropriate CDN to use: <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
If you want to use Vue 3 (the recommended version), the Vue 3 docs include the correct code needed to get started with a basic app:
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<div id="app">{{ message }}</div>
<script>
const { createApp } = Vue
createApp({
data() {
return {
message: 'Hello Vue!'
}
}
}).mount('#app')
</script>
Notice the use of createApp()
instead of Vue 2’s new Vue()
Source:stackexchange.com