第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Bootsrap 按鈕在 React 中無(wú)法正常工作

Bootsrap 按鈕在 React 中無(wú)法正常工作

千巷貓影 2023-12-11 14:59:23
我正在 React 中構(gòu)建一個(gè)響應(yīng)式導(dǎo)航欄,當(dāng)您放大頁(yè)面時(shí),它會(huì)隱藏鏈接并顯示一個(gè)帶有帶有鏈接的下拉列表的按鈕。問(wèn)題是,當(dāng)我單擊按鈕時(shí),它不會(huì)執(zhí)行任何操作,并且在引導(dǎo)網(wǎng)站中,它可以正常運(yùn)行。我做錯(cuò)了什么嗎?這是我的代碼:import React, { Component } from 'react';import axios from "axios";import { Redirect } from "react-router-dom"import styles from '../styles/loginsignup.css'import logo from '../img/nowyourguest.png'import 'bootstrap/dist/css/bootstrap.min.css'import 'jquery/dist/jquery.min.js'import 'bootstrap/dist/js/bootstrap.min.js'export default class Login extends Component {  state = {    email: '',    password: ''  };  handleSubmit = event => {    event.preventDefault();    const {email, password} = this.state;    axios({      url: "/authentication/signin",      method: "POST",      data: {        email,        password      }    })      .then(response => {        const isAuthenticated = response.data.isAuthenticated        window.localStorage.setItem('isAuthenticated', isAuthenticated);        this.props.history.push('/profile')      })      .catch(error => {        this.setState({          errorMessage: error.response.data.message        })      })  };  handleChange = event => {    const {name, value} = event.target;    this.setState({      [name]: value    })  }  render() {    const isAuthenticated = window.localStorage.getItem('isAuthenticated');    if (isAuthenticated) {      return <Redirect to='/profile'/>    }
查看完整描述

3 回答

?
縹緲止盈

TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個(gè)贊

該按鈕不起作用,因?yàn)樗Q于jQuery,因?yàn)槟枰猨Query在代碼中安裝,但我不建議您jQuery在代碼中安裝。


為此,您可以使用react-bootstrap


<button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

    <span className="navbar-toggler-icon" />

</button>


查看完整回答
反對(duì) 回復(fù) 2023-12-11
?
忽然笑

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超5個(gè)贊

您需要將您的button點(diǎn)擊與其處理程序連接起來(lái)


基本用法假設(shè)您使用有狀態(tài)或基于類的組件。


const onClickHandler = (e) =>{

     console.log(e);

}


render(){

  <button onClick={this.onClickHandler}>Click Me!</button>

}


查看完整回答
反對(duì) 回復(fù) 2023-12-11
?
MMMHUHU

TA貢獻(xiàn)1834條經(jīng)驗(yàn) 獲得超8個(gè)贊

所以我必須在index.html中導(dǎo)入jquery,這就是我導(dǎo)入它的方式:


<!DOCTYPE html>

<html dir="ltr">

<head>

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />

  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">

</head>


<body>

    <div id="root"></div>



    <!-- Turbo library imports: jQuery, Turbo CDN, sample app.js -->

    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>

    <script type="text/javascript" src="/dist/js/vendor.min.js"></script>

    <script type="text/javascript" src="https://cdn.turbo360-dev.com/dist/turbo.min.js"></script>

    <script type="text/javascript" src="/dist/bundle/commons.js"></script>

    <script type="text/javascript" src="/dist/bundle/app.js"></script> <!-- React code bundle -->

</body>

</html>


查看完整回答
反對(duì) 回復(fù) 2023-12-11
  • 3 回答
  • 0 關(guān)注
  • 211 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)