jQuery选项卡不会加载

时间:2018-10-03 03:37:55

标签: jquery tabs

我似乎无法在页面上加载选项卡。我收到错误消息:

TypeError:$(...)。tabs不是函数

这是我的代码:

import React from 'react';
import {Button, FormGroup, FormControl, ControlLabel} from "react-bootstrap";
import './login.css';

export default class loginForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      username: '',
      password: '',
      answer:[],
    };
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  async handleSubmit(event) { 
    const jso = JSON.stringify({
      username: this.state.username,
      password: this.state.password
    })
    const response = await fetch("https://app.herokuapp.com/authentication", {
      method: 'POST',
      mode: 'cors',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: jso,
    })

    const json = await response.json()

    this.setState({answer:json});

    //check if user is authentificated
    alert("Server Answer : "+ this.state.answer.answer);
    if(this.state.answer.answer.localeCompare('true') == 0){
      this.props.app.setState({auth: true});
      sessionStorage.setItem('auth', true);
    }
    else if (this.state.username != ""){
      alert("INCORRECT USERNAME PASSWORD ");
    }
  }


  render() {

    return (<div className="Login">
      <form onSubmit={this.handleSubmit}>
        //part omitted because not relevant for this question
        <Button bsSize="small" color="primary" type="submit">
          Login
        </Button >
      </form>
    </div>)
  }
}

` 我想念的是什么?

1 个答案:

答案 0 :(得分:0)

您需要使用更高版本的jQuery。

您可以将<script src="https://code.jquery.com/jquery-1.12.4.js"></script>更改为:

2x:<script src="https://code.jquery.com/jquery-2.2.4.js"></script>

3x:<script src="https://code.jquery.com/jquery-3.3.1.js"></script>