admin管理员组文章数量:1431391
I can get a unique id withInstanceId , but I get a bug like this on my block in dev console.
Expected:
<div id="deneme-carousel-1" class="owl-carousel owl-theme"></div><script>jQuery( document ).ready( function() { jQuery('#deneme-carousel-1').owlCarousel();</script>
Actual:
<div id="deneme-carousel-21" class="owl-carousel owl-theme"></div><script>jQuery( document ).ready( function() { jQuery('#deneme-carousel-21').owlCarousel();</script>
index.js
save: withInstanceId( function( { instanceId} ) {
return(
<div id={`deneme-carousel-${ instanceId }`} className={ classnames( 'owl-carousel', 'owl-theme', className ) }>
</div>
<script>
{'function() { jQuery(\'#'+`deneme-carousel-${instanceId}`+'\').owlCarousel();'}
</script>
} ),
版权声明:本文标题:plugin development - There is a problem in the gutenberg block I developed. Problem is with withInstanceId 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745584219a2664796.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论