简体   繁体   English

在不支持ECMA脚本的Javascript中如何写这条语句?

[英]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.

相关问题 如何证明我的JavaScript文件属于特定JS或ECMA版本? - How can I prove that my JavaScript files are in the scope of a specific JS or ECMA version? 如何编写JavaScript脚本来修改此CSS文件? - How can I write the javascript script to modify this css file? 我知道如何将 if 语句写成公式,但不是在脚本中 - I know how to write and if statement as a formula, but not in a script `for of` JavaScript 语句的支持情况如何? - How well is the `for of` JavaScript statement supported? 如何使用 ECMA 模块在 nodejs 中导入.json 文件? - How can I import .json files in nodejs using ECMA Modules? 如果ECMA 6是标准的,那么为什么主浏览器不支持简单脚本? - If ECMA 6 is standard, then why simple script isn't supported in main browsers? 通过import语句加载的ECMA-Script 2015(及更高版本)模块实际上在后台如何工作? - How actually ECMA-Script 2015 (and above) module loading through import statement works behind the scenes? 我该如何写较短的jQuery语句? - How can I write this jQuery statement shorter? 在编写JavaScript的脚本编辑器中,如何在SharePoint中调试? - how do the debug in SharePoint in script editor where we write javascript? 如何使用 if/else 语句编写 javascript 函数来检查是否<div>类包含一个<img>或者<img>班级 - How can I write a javascript function with the if/else statement to check whether a <div> class contains a <img> or <img> class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM