JSPM

  • Created
  • Published
  • Downloads 94659
  • Score
    100M100P100Q156554F
  • License MIT

Codemirror component for Vue.js

Package Exports

  • vue-codemirror

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-codemirror) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vue-codemirror

Codemirror components for Vue.js

Screenshots

image

image

Build Setup

# install vue-codemirror
npm install vue-codemirror


# Vue use

## import with ES6
import Vue from 'vue'
...
import CodeMirror from 'vue-codemirror'


## require with Webpack
var Vue = require('vue')
...
var CodeMirror = require('vue-codemirror')

## use
Vue.use(CodeMirror)        // use vue-codemirror es5 (default && recommend)
Vue.use(CodeMirror.es6)    // use vue-codemirror es6 (need babel support)


# use in components
<codemirror></codemirror>


# component data bind
<codemirror :code.sync="code"></codemirror>


# component config example 1
<codemirror :code.sync="code" :options="editorOption"></codemirror>

data () {
  return {
    code: 'const a = 10',
    editorOption: {
      tabSize: 4,
      mode: 'javascript',
      theme: 'base16-dark',
      lineNumbers: true, 
      line: true,
      ...
    }
  }
}


# component config example 2
<codemirror :code.sync="css" :options="{ tabSize: 2, mode: 'css' }"></codemirror>

data () {
  return {
    css: '.class { display: block }'
  }
}

More example

More Codemirror Config

Author Blog

Surmon