gpt4 book ai didi

javascript - vue数据函数语法

转载 作者:行者123 更新时间:2023-11-28 14:20:06 25 4
gpt4 key购买 nike

编译我的资源时遇到以下语法错误:

Syntax Error: SyntaxError: C:\xampp\htdocs\dtcburger.com\resources\js\components\stripe\STRIPEform3.vue: Unexpected token, expected ";" (51:12)

49 | {
50 | stripe:null,
> 51 | stripePK: stripePK,
| ^
52 | stripeStyles: stripeStyles,
53 | cardNumberElement:null,
54 | cardExpiryElement:null,

这是我的代码的样子,是否是因为我对组件数据使用了 ES 语法?

最佳答案

您需要返回对象 - 将函数括在括号中并简单地返回对象文字:

data: () => (
{
stripe: null,
stripePK: stripePK,
//All your other properties
}
)

或者,使用return语句:

data: () => {
return {
stripe: null,
stripePK: stripePK
//All your other properties
}
}

关于javascript - vue数据函数语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55553429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com