1.0.1 • Published 3 years ago

@aligov/monaco-diff-editor v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

DiffEditor

@aligov/monaco-diff-editor

intro component

API

参数名说明必填类型默认值备注
original原始值falsestring
value当前值truestring
language语言truestring
options配置falseobject同monaco的options

基础用法

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import MonacoDiffEditor from '@aligov/monaco-diff-editor';

class App extends Component {
  constructor(props) {
    super(props)
    this.editor = React.createRef();
  }

  getValue = () => {
    console.log(this.editor.current.getValue())
  }
  
 
  render() {
     return (
      <div style={{height: 300}}>
      <button onClick={this.getValue}>获取当前值</button>
        <MonacoDiffEditor ref={this.editor} original="ww"/>
      </div>
    );
  }
}

ReactDOM.render((
  <App />
), mountNode);