添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I’m following the Vue.js crash course on youtube (by Traversy Media), and I’m using VS Code to follow along the tutorial, but I’m having trouble with the function, data, and return tags.

Here’s a screenshot of my app.js page on Vs Code:
Screen Shot 2022-07-23 at 1.25.32 PM 922×604 44 KB

Why does the “function()” part marked red and how do I fix that?
On the crash course video, the guy uses “data()” instead of “function()” and it works fine.

Please include a link to the video and maybe a timestamp.
Also hover with the mouse over the underlined word and you should get an error message explaining the issue.
Oh and ofcourse please don’t post images but plain code.

charcuterie-poot:

On the crash course video, the guy uses “data()” instead of “function()” and it works fine.

…then use “data()” and not “function()”?

Here is the video: Vue JS Crash Course - YouTube at (11:19)

The message when I hover over the code says:

',' expected.ts(1005)
(method) function(): {
    firstName: string;

Right, here’s the code:

const app = Vue.createApp({
    template: '<h1>Hello {{firstName}}</h1>'
    function() {
        return {
            firstName:'John'
app.mount('#app')