我试图在另一个文件中调用模式视图,但出现“不是构造函数”错误。我的模态组件看起来像:
ModalView.js:
export default class ModalView extends Modal {
constructor() {
super(onClose => {});
this.setNoMaxHeight(false);
this.setWidthPercentage(0.4);
}
closeModal = () => {
this.close();
};
renderContent() {
return <ModalContent closeModal={this.closeModal} />;
}
}
我从中调用的文件如下:
Product.js:
require(
[
'lego/component//ModalView'
],
function({ ModalView }) {
events: {
'click #apply': 'apply',
},
modalView: function () {
new ModalView().render();
}
我正在其他地方使用“ .render()”在反应文件中渲染模式视图,所以我不确定在这里做错了什么。
答案 0 :(得分:0)
在 Product.js 中,当您未在 ModalView 组件上定义 .render()时,您正在调用它。
我假设您打算打电话。 renderContext()