未捕获的错误:解析错误:意外的令牌

时间:2015-07-22 07:57:44

标签: parse-platform reactjs

新的解析和反应,我正在收到此错误

  

未捕获错误:解析错误:第50行:意外令牌

     

观察:function(){

我该如何解决?

这是我的整个代码

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="viewport" content="width=device-width">
  <link href=&#39;http://fonts.googleapis.com/css?family=Roboto:400&#39; rel=&#39;stylesheet&#39; type=&#39;text/css&#39;>
  <script src="http://fb.me/react-0.13.3.min.js"></script> 
    <script src="https://www.parsecdn.com/js/parse-latest.js"></script> 
    <!-- Now include parse-react.js -->
    <script src="https://www.parsecdn.com/js/parse-react.js"></script> 
</head>

<body>

<script src="./jquery.min.js"></script>
<script src="./jquery.velocity.min.js"></script>
<script src="./velocity.ui.min.js"></script>
<script src="./react.js"></script>
<script src="./JSXTransformer.js"></script>
<script type="text/jsx">

    /** @jsx React.DOM */
    var App = React.createClass({   
        render: function() {        
            var name=null;
            var password=null;
            var email=null;

            return (
                <div>
                  <label>Name</label>
                  <input type="text" ref="name"  /><br/>

                  <label>Password</label>
                  <input type="password" ref="password" /><br/>

                  <label>Email</label>
                  <input type="email" ref="email"  /><br/>

                  <button onClick={this.saveAndContinue}>
                    Save and Continue
                  </button>
                </div>
              )
          },

          saveAndContinue: function(e) {
              e.preventDefault()
              //debugger;
              // Get values via this.refs
              data = {
                  name: this.refs.name.getDOMNode().value,
                  password: this.refs.password.getDOMNode().value,
                  email: this.refs.email.getDOMNode().value,
              }
              //this.props.saveValues(data)
          },     

          //this.props.nextStep()

          saveValues: function()
          {
              return function()
              {
                  mixins: [ParseReact.Mixin],    
                  observe: function() {
                      return {

                      };
                  }
              }
          }
      }
  );

  React.renderComponent(<App />,  document.body);

</script>

</body>
</html>

由于我是新手,所以任何帮助都将受到赞赏。谢谢

1 个答案:

答案 0 :(得分:1)

saveValues是一个返回函数的函数。在返回的函数体中,您似乎尝试使用对象文字语法。

function() {
    a: "something",
    b: "something else"
}

是无效的语法。你可能想要返回一些对象。