0

设置值时出现错误。我正在尝试设置 JavaScript 代码,但出现以下错误。

Document.$detectNewLine
node_modules/ace-builds/src-noconflict/ace.js:7832
  7829 | 
  7830 | 
  7831 | this.$detectNewLine = function(text) {
> 7832 |     var match = text.match(/^.*?(\r\n|\r|\n)/m);
       | ^  7833 |     this.$autoNewLine = match ? match[1] : "\n";
  7834 |     this._signal("changeNewLineMode");
  7835 | };

我的编辑器设置是

<AceEditor 
                        mode="javascript"
                        theme="github"
                        name="editor"
                        value={this.setValue}
                        editorProps={{$blockScrolling: true}}
                        setOptions={{
                            enableBasicAutocompletion: false,
                            enableLiveAutocompletion: false,
                            enableSnippets: false,
                            showLineNumbers: true,
                            tabSize: 2,
                        }}
/>```
 The setValue is

    `
    setValue = async () => {
        let demo = await this.state.getCodeFromFile.success;
        return demo;
    }`
4

1 回答 1

1

您是否尝试过从 setOptions 中删除最后一个逗号?这曾经给我带来了一些问题。

它看起来像这样:

setOptions={{
                            enableBasicAutocompletion: false,
                            enableLiveAutocompletion: false,
                            enableSnippets: false,
                            showLineNumbers: true,
                            tabSize: 2
                        }}
于 2020-03-24T17:17:37.310 回答