Ich kann nicht scheinen, semantische ui Arbeit innerhalb der React-Komponente zu machen. JQuery funktioniert ordnungsgemäß. Das semantische Akkordeon reagiert jedoch nicht auf Klickereignisse.Wie werden semantische UI-Module in React verwendet?
import React, { Component } from 'react'
import 'semantic-ui/dist/semantic.min.css'
import $ from 'jquery'
import jQuery from 'jquery'
window.jQuery = jQuery
import 'semantic-ui/dist/semantic.min.js'
export default class App extends Component{
render(){
return(
<div>
<h1>Hello, React!</h1>
<div className="ui slider checkbox">
<input type="checkbox" name="newsletter" />
<label>Accept terms and conditions</label>
</div>
<div className="ui styled accordion">
<div className="active title">
<i className="dropdown icon"></i>
What is a dog?
</div>
<div className="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
<div className="title">
<i className="dropdown icon"></i>
What kinds of dogs are there?
</div>
<div className="content">
<p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
</div>
<div className="title">
<i className="dropdown icon"></i>
How do you acquire a dog?
</div>
<div className="content">
<p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
<p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
</div>
</div>
</div>
)
}
}
Ist Semantic-Ui ein Knotenmodul? Oder eine Datei? Wenn es eine Datei ist, müssen Sie so aussehen: 'importieren './path/to/file/filename';' –
@DavinTryon Es ist ein Knoten-Modul .. Die CSS-und JS-Dateien laden perfekt, aber für unbekannter Grund js-Datei kann JQuery nicht finden. Es sagt "uncaught referenz: jquery" – Mihir