【发布时间】:2020-03-17 04:25:29
【问题描述】:
我有一些问题,在我的项目中我需要在我的项目中添加Sanitize.js,我已经复制到我自己的第 3 方文件夹前供应商 导入它我正在使用
import {san} from '../../vendor/Sanitize' //There's No error when compiling this one
但是当我运行页面时出现错误,我正在尝试从 Sanitize.js 调用该函数,就像自述文件中所说的那样使用它
var s = new san.Sanitize({
elements: ['a', 'span'],
attributes: {
a: ['href', 'title'],
span: ['class']
},
protocols: {
a: { href: ['http', 'https', 'mailto'] }
}
});
s.clean_node(p);
错误是
san.Sanitize 不是函数/类构造函数
知道为什么会这样吗?还是我错过了什么?编译过程中没有错误,只有在我尝试运行网页时才会出现错误,
【问题讨论】:
标签: javascript reactjs typescript