【问题标题】:Module parse failed: Unexpected token . You may need an additional loader to handle the result of these loaders模块解析失败:意外的令牌。您可能需要额外的加载器来处理这些加载器的结果
【发布时间】:2021-12-13 19:48:03
【问题描述】:

message?.length === 1这个语法是什么,谁能解释一下如何将它转换成普通的javascript?

这是我从某处下载的 vue js 组件,但是当我放入我的项目时出现错误

【问题讨论】:

    标签: javascript node.js vue.js npm


    【解决方案1】:

    a?.b 是“可选链接”运算符,当链接的属性之一为 undefined 或 null 时,它返回 undefined。

    message?.length === 1 可以替换为message && message.length === 1。

    【讨论】:

      猜你喜欢
      • 2020-04-05
      • 2020-12-04
      • 1970-01-01
      • 2020-09-12
      • 1970-01-01
      • 1970-01-01
      • 2022-11-06
      • 2021-08-05
      • 1970-01-01
      相关资源
      最近更新 更多