未捕获的TypeError:$(...)。material_select不是函数

时间:2017-04-21 23:29:25

标签: jquery reactjs select materialize

我在表单中使用react-materialize select组件,并且在页面加载时没有显示。当应用程序启动时,它会抛出错误Uncaught TypeError: $(...).material_select is not a function

我不知道为什么会这样。请帮忙。

这是我的表格:



import React from 'react';
import { Row, Input, Button } from 'react-materialize';

const DocumentForm = ({ document, onSave, onChange, saving, errors }) => {
  return (
    <form>
      <h5>Create/Update a Document</h5>
      <Row>
        <Input
          placeholder="Title"
          s={12}
          validate
          name="title"
          onChange={onChange}
          value={document.title}
          error={errors.title}
          id="title"
        />
        <Input
          placeholder="Content"
          s={12}
          validate
          type="textarea"
          name="content"
          onChange={onChange}
          value={document.content}
          error={errors.content}
          id="content"
        />
        <Input
          s={12}
          validate
          type="select"
          onChange={onChange}
          value={document.access}
          name="access"
          error={errors.access}
          id="access"
        >
          <option value="public">Public</option>
          <option value="private">Private</option>
          <option value="role">Role</option>
        </Input>

        <Input
          type="submit"
          disabled={saving}
          value={saving ? 'Saving...' : 'Save'}
          className="btn waves-effect waves-light blue"
          onClick={onSave}
        />
      </Row>
    </form>
  );
};

DocumentForm.propTypes = {
  document: React.PropTypes.object.isRequired,
  onSave: React.PropTypes.func.isRequired,
  onChange: React.PropTypes.func.isRequired,
  saving: React.PropTypes.bool.isRequired,
  errors: React.PropTypes.object.isRequired,
};

export default DocumentForm;
&#13;
&#13;
&#13;

0 个答案:

没有答案