[英]PhotoSwipe in ReactJs
我正在嘗試在ReactJs組件中使用PhotoSwipe ,但它不起作用。
為了簡單起見:
我已經從這里獲取所有html,並將其放入react組件中的render中。 我已將所有js放入ComponentDidMount
方法中。
我推圖像標題,並得到Uncaught TypeError: undefined is not a function
gallery.init();
上Uncaught TypeError: undefined is not a function
gallery.init();
所有class
更改為className
以及所有itemScope, itemType, itemProp, tabIndex
怎么了?
作為回應,您必須先構建組件,然后才能執行“ ComponentDidMount”。 因此,在react組件中呈現您的html。 像這樣 :
var something = React.createClass ({
render : function () {
return(
<div>
//Your html code here
</div>
)
}
});
之后,您可以使用something組件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.