vue-codemirror插件使用


安装
npm install vue-codemirror -S

在mian.js中注册

import VueCodemirror from 'vue-codemirror'
import 'codemirror/lib/codemirror.css'

Vue.use(VueCodemirror)

vue中
``

点击查看代码
 
            

data中:

点击查看代码
cmOptions: {
        tabSize: 4,
        styleActiveLine: true,
        lineNumbers: true,
        line: true,
        // mode: 'text/javascript',
        mode:{
          name:"javascript",
          json:true
        },
        lineWrapping: true,
        theme: 'material'
        },

还得在组件中注册引入
components: {
jsonView,codemirror
},

vue