Hola, actualmente estoy aprendiendo Vue.js y tengo un problema con él. Estoy llamando a Vue usando un CDN.
He seguido las instrucciones pero no parece reconocer que Vue existe.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Vue Basics</title> <link href="https://fonts.googleapis.com/css2?family=Jost:wght@400;700&display=swap" rel="stylesheet" /> <link rel="stylesheet" href="styles.css" /> <script src="https://unpkg.com/vue@3"></script> <script src="app.js" defer></script> </head> <body> <header> <h1>Vue Course Goals</h1> </header> <section id="user-goal"> <h2>My Course Goal</h2> <p>{{coarseGoal}}</p> </section> </body> </html>
Este es el archivo js simple. No genera el código del objeto Vue.
Realmente agradecería cualquier ayuda en esto.
const app = vue.createApp({ data () { return { coarseGoal: 'This is the best', }; } }); app.mount('#user-goal');
Debería ser Vue.createApp
en lugar de vue.createApp
.
violín de trabajo
const app = Vue.createApp({ data() { return { coarseGoal: 'This is the best', }; } }); app.mount('#user-goal');
<title>Vue Basics</title> <link href="https://fonts.googleapis.com/css2?family=Jost:wght@400;700&display=swap" rel="stylesheet" /> <link rel="stylesheet" href="styles.css" /> <script src="https://unpkg.com/vue@3"></script> <body> <header> <h1>Vue Course Goals</h1> </header> <section id="user-goal"> <h2>My Course Goal</h2> <p>{{coarseGoal}}</p> </section> </body>