微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

DOM中未显示react codemirror2

如何解决DOM中未显示react codemirror2

enter image description here

我已经尝试过在此页面上找到的内容react-codemirror2 has no CSS effect

但是我只得到图片显示内容,有人可以帮我吗?

import React,{ Component } from "react";

// Import the code mirror component.
import { Controlled } from "react-codemirror2";

// The following two imports is for the theme.
import 'codemirror/lib/codemirror.css';
import 'codemirror/theme/material.css';

// This import is for the language Syntax highlighting.
import 'codemirror/mode/javascript/javascript.js';

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
       src: ''
    }
  }

  render() {
    let option = {
      mode: 'javascript',theme: 'material'
    };

    return (
      <div>
        <Controlled
          value={this.state.src}
          option={option}
          onBeforeChange={(editor,data,value) => {
            this.setState({ src: value });
          }}
          onChange={(editor,value) => {}}
        />
      </div>
    )
  }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。