关于在 wxs 中小程序不能使用箭头函数

在学习的过程中,我发现虽然小程序已经支持了箭头函数 但在wxs脚本中,还是需要使用function来实现封装,代码如下:

<wxs module="m1">
  module.exports.toUpper = function(str) {
    return str.toUpperCase()
  }

  module.exports.add = (a, b) => {
    return a + b;
  }
</wxs>

上面的函数toUpper可以使用,但下面的add无法使用,报错如下:

[自动热重载错误 WXML 文件编译错误] Error 141: ./pages/message/message.wxml:13:33:Unexpected token > (env: Windows,mp,1.06.2401020; lib: 3.3.4)

希望未来微信会将bug修复。