我在magento 2中使用javascript制作这个模型。它给出了这个错误。不知道是什么问题,它工作了几天。
<div id="custom-popup-modal">
<div class="col-sm-6">
<div class="static_content">
<h5 class="min-title-bold">JOIN THE PARTY</h5>
<h2 class="min-title-large">GET 15% OFF YOUR FIRST ORDER*</h2>
<p class="small-content">Subscribers only discounts, first look at new products, and cutting-edges tips</p>
{{block class="Magento\Newsletter\Block\Subscribe" name="static.newsletter" template="Magento_Newsletter::subscribe.phtml"}}
<p class="micro-text">*Promo code will be emailed to the address you enter, New subscribers only</p>
</div>
</div>
<div class="col-sm-6 img-section"><img src="{{media url="wysiwyg/image-email_1.gif"}}" alt="" /></div>
</div>
<script type="text/javascript" xml="space">// <![CDATA[
//
//
//
require(['jquery','Magento_Ui/js/modal/modal'],
function($,modal) {
var options = {
type: 'popup',
responsive: true,
};
var popup = modal(options, $('#custom-popup-modal'));
$( document ).ready(function() {
$('#custom-popup-modal').modal('openModal');
});
}
);
//
//
//
// ]]></script>
1条答案
按热度按时间ruoxqz4g1#
这可能是一个类似的问题:https://magento.stackexchange.com/questions/174029/cannot-call-methods-on-modal-prior-to-initialization-attempted-to-call-method
解决方案:
而不是在代码中使用以下代码:
使用此选项:
其他参考:jquery ui Dialog: cannot call methods on dialog prior to initialization