taro+vue 使用taro ui vue 报错 这是为什么?



  • ./node_modules/taro-ui-vue/src/components/button/index.ts
    Module build failed (from ./node_modules/@tarojs/webpack-runner/node_modules/babel-loader/lib/index.js):
    SyntaxError: D:\newzhongke\mapapp\node_modules\taro-ui-vue\src\components\button\index.ts: Unexpected token, expected "," (157:23)

    155 | methods: {
    156 | classNames,

    157 | handelOnClick(event: CommonEvent): void {
    | ^
    158 | if (!this.disabled) {
    159 | this.onClick && this.onClick(event)
    160 | }
    at Parser._raise (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\error.js:60:45)
    at Parser.raiseWithData (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\error.js:55:17)
    at Parser.raise (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\error.js:39:17)
    at Parser.unexpected (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\util.js:139:16)
    at Parser.expect (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\util.js:116:28)
    at Parser.parseBindingList (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\lval.js:281:14)
    at Parser.parseFunctionParams (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\statement.js:1125:24)
    at Parser.parseMethod (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:2005:10)
    at Parser.parseObjectMethod (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:1847:19)
    at Parser.parseObjPropValue (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:1919:12)
    at Parser.parsePropertyDefinition (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:1778:10)
    at Parser.parseObjectLike (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:1648:25)
    at Parser.parseExprAtom (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:1091:21)
    at Parser.parseExprSubscripts (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:563:23)
    at Parser.parseUpdate (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:543:21)
    at Parser.parseMaybeUnary (D:\newzhongke\mapapp\node_modules@babel\parser\src\parser\expression.js:527:17)



  • 不知道为什么,用TS就不报错了



  • presets: [
    ['taro', {
    framework: 'vue',
    ts: true
    }]
    ],
    设置这个就行了


登录后回复