[英]How can I write this statement in Javascript where ECMA Script is not supported?
I am trying to write this statement in simple javascript where import is not supported..我试图在不支持导入的简单 javascript 中编写此语句。
import IconAlignLeft from 'quill/assets/icons/align-left.svg';从 'quill/assets/icons/align-left.svg' 导入 IconAlignLeft;
That isn't even standard JavaScript. The use of import
for things that are not JS modules is a feature of some bundlers (such as Webpack — relevant documentation is here ).这甚至不是标准的 JavaScript。对非 JS 模块的东西使用
import
是一些打包器的功能(例如 Webpack -相关文档在这里)。
There is no direct equivalent in plain JavaScript (in versions with or without support for modules).普通 JavaScript 中没有直接等效项(在支持或不支持模块的版本中)。
The nearest equivalent would be:最接近的等价物是:
const IconAlignLeft = "A string containing a URL that points to the SVG";
… but you would need to implement your own process for making the image available at the URL you specify. …但您需要实施自己的流程,使图像在您指定的 URL 可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.