预期的破坏

时间:2018-06-02 15:41:28

标签: ios swift

我试图解决这个问题。我看过其他有同样问题的人,但没有解决任何问题。

我得到了#34;预期声明"错误就行:

import React, { Component } from 'react';
import CardOne from './CardOne';
import CardTwo from './CardTwo';
import CardThree from './CardThree';

export default class Form extends Component {
  state = {
    number: '',
    showOne:true,
    showTwo:false,
    showThree:false,
    userInputValue:''
  };

  change = (e) => {
    this.setState({
      userInputValue: e.target.value
    });
  };

  onSubmit = e => {
    e.preventDefault();
    this.props.onSubmit(this.state);
    if (this.state.userInputValue > 10 && this.state.userInputValue <20 ){
      this.setState({
        showTwo: true,
      })
    }
    if (this.state.userInputValue > 20 && this.state.userInputValue < 30) {
      this.setState({
        showThree: true,
      })
    }
  };

  render() {
    return (
      <div>
      <form>
        <label>Number</label>
        <input
          type="number"
          name="number"
          placeholder="Number"
          value={this.state.userInputValue}
          onChange={e => this.change(e)} />

        <button onClick={e => this.onSubmit(e)}>Submit</button>
      </form>
      <div>
      {this.state.showOne ? 
            <CardOne />
       :
       <div></div>
      }
      {this.state.showTwo ?
        <CardTwo />
        :
        <div></div>
      }
      {this.state.showThree ?
        <CardThree />
        :
        <div></div>
      }
      </div>
      </div>
    )
  }
}

// What i wrote above is your base functionality . You reedit the condition depends on ur requirement .

代码:

super.viewDidLoad(){

2 个答案:

答案 0 :(得分:2)

更正声明

 override func viewDidLoad() {
    super.viewDidLoad()  
    //
 }

答案 1 :(得分:2)

函数声明不正确。

override func viewDidLoad() {
    super.viewDidLoad()

    score = 0
    Bluelbl.text = "\(score)"
    Redlbl.text = "\(score)"

    Bluelbl.transform  = CGAffineTransform (rotationAngle: 3.14)

    Restart.transform  = CGAffineTransform (rotationAngle: 1.57)
    TopEndLbl.transform = CGAffineTransform (rotationAngle: 3.14)
    EndScene.isHidden = true
    TopEndLbl.isHidden = true
    BtmEndLbl.isHidden = true
    Restart.isHidden = true
}