【问题标题】:Remove accents/diacritics in a string in Angular Probleme with IE 11使用 IE 11 在 Angular Probleme 中删除字符串中的重音符号/变音符号
【发布时间】:2021-10-13 09:25:15
【问题描述】:

我尝试使用 String.normalize("NFD").replace(/[\u0300-\u036f]/g, "") 但我在 IE11 中出现此错误

ERROR TypeError: L'objet ne gère pas la propriété ou la méthode « normalize »

【问题讨论】:

  • 您好,请问这个问题呢? my answer below 对处理问题有帮助吗?如果有什么我可以帮助的,请告诉我。

标签: javascript angular typescript internet-explorer


【解决方案1】:

您在 IE 11 中遇到错误是因为 IE doesn't support normalize

IE 11 需要使用 polyfill 支持normalize。IE 11 可以使用模块unorm 来支持normalize

  1. 运行npm install unorm
  2. 在您编写normalize 函数的文件中使用import 'unorm';

【讨论】:

  • 谢谢,但我是在 C# 的后端完成的
猜你喜欢
  • 2022-01-03
  • 1970-01-01
  • 2010-09-19
  • 2012-12-10
  • 2015-08-30
  • 1970-01-01
相关资源
最近更新 更多