On Vue2 I just add the CDN then I have Vue available on my js files, but Vue3 I could not do the same - My js files does not detect Vue. How can I solve it in order to use Vue3?
On Vue2 I just add the CDN then I have Vue available on my js files, but Vue3 I could not do the same - My js files does not detect Vue. How can I solve it in order to use Vue3?
Share Improve this question edited Aug 6, 2020 at 15:16 Boussadjra Brahim 1 asked Aug 6, 2020 at 15:02 Thiago AraujoThiago Araujo 1893 silver badges15 bronze badges 3- use cdn to load vue.js – Harish Mahamure Commented Aug 6, 2020 at 15:05
- 1 @Thiago I'v got an example fiddle here jsfiddle/dapo/Ly0zdcb4 seems to be working fine. Can you clarify what issue you're having? – Daniel Commented Aug 7, 2020 at 15:36
- @Daniel, follow the the link to the git repository working on Django with Vue2: github./u7540936/ToDoApp_Django_Vue2. In Static > vue_axios folder, I have vue.js (Vue2), axios and the the "Main.js". Probably it is some simple different from Vue2 I did not figure out yet. – Thiago Araujo Commented Aug 7, 2020 at 16:59
2 Answers
Reset to default 9You will need to include the new vue js file
You can get source from here https://unpkg./[email protected]/dist/vue.global.js and link or include in your project
I cut out some stuff (axios, methods, template, etc.) But this should give you an idea.
The important parts...
- use
createApp
from Vue either usingVue.createApp
or using destructuring data
needs to be a function that returns an object
Example:
const app = Vue.createApp({
el: '#app',
delimiters: ['[[', ']]'],
data() {
return {
returned_task: '',
new_task: '',
create_modify: '',
modify_id: -1,
modify_index: -1,
tasks: []
}
},
created() {
this.tasks = ['do this