簡體   English   中英

在ReactJs中進行PhotoSwipe

[英]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.

 
粵ICP備18138465號  © 2020-2025 STACKOOM.COM