vue-template-babel-compiler
vue-template-babel-compiler copied to clipboard
[Fixed Bug] template里面写对象方法的简写形式报错
<div :rules="[{ transform(value) { return +value} }]"></div>
改成这样就不报错
<div :rules="[{ transform: function(value) { return +value} }]"></div>
报错信息:
[vite-plugin-vue2] /Users/admin/work/code/brick/esop2-support/VueTemplateBabelCompiler: Property key of ObjectMethod expected node to be of a type ["Identifier","StringLiteral","NumericLiteral"] but instead got "MemberExpression"
这是个BUG。感谢你的反馈😊
shouldPrependVm() 对 [objectMethod](https://babeljs.io/docs/en/babel-types#objectmethod)类型的AST节点,错误地返回了 true,给transform()错误地加上了_vm.前置。
我们增加一个 t.isObjectMethod(path.container) 应该能修复问题。

欢迎你发个 PullRequest 修复这个问题!
你可以参考 CONTRIBUTING.md 调试、增加测试用例、创建 PR.
This issue has been fixed by v2.0, try it by: npm install vue-template-babel-compiler@latest