Comments (9)
@Changed方法是给2.0用的
1.0你可以通过下面这些方式应用
<!-- 单向数据绑定(即codemirror的变化不会再响应回来) -->
<codemirror :code="code" :options="editorOption"></codemirror>
<!-- 双向数据绑定(2.0已废弃) -->
<codemirror :code.sync="code" :options="editorOption"></codemirror>
如果你要监听codemirror 的变化,可以双向数据绑定,并且在watch中watch你所绑定的变量,然后作出相应操作
from vue-codemirror.
哦 那请问你这插件可以加入 "hint/show-hint.js"
"hint/sql-hint.js"这个两个js文件的配置项 实现autocomplete吗 我试着在editOption中加了 没有起作用
editorOption:{
lineNumbers: true,//设置行号 boolean
value: 'SELECT * FROM table',//编辑框初始值 string
mode: 'text/x-mysql',//当前code模式 模式的选择可以在CodeMirror.modes中查看
height: 100,//高度
indentUnit: 4,//缩进块用多少个空格表示 默认是2
autofocus: true,
//此处是引用sql-hint.js的配置项
hintOptions:{
completeSingle: false, //当匹配只有一项的时候是否自动补全
tables: {
table1: ['name', 'score', 'birthDate'],
table2: ['name', 'population', 'size']
}
},//表元信息
extraKeys: {//快捷键 可提供三种模式 sublime、emacs、vim。 使用时需要引入js支持包
"F9": function (editor) {
format(editor);
},
"F8": function (editor) {
query(editor);
}
}
}
from vue-codemirror.
如果有 hint/show-hint.js 来源的详细信息,可以提供一下
from vue-codemirror.
找到了,下一个版本增加/修复此功能,本周内完成
from vue-codemirror.
哇塞 果然是大神 坐等下一个版本 给你点32个赞
from vue-codemirror.
还有一个比较大的问题 现在code数据不是放在data中 是放在computed中计算属性得到的,这样我改变其值,如何检测其变化,将计算属性的来源值改变
computed:{code() getTabData.sql}
我要在改变codemirror中的值时候去改变 getTabData.sql的值,应该如何去做?
from vue-codemirror.
文档通读一遍,这个问题就解决了
from vue-codemirror.
你是指vue的文档还是你的组件文档 找了一遍没找着 球指教
from vue-codemirror.
https://github.com/surmon-china/vue-codemirror#use-in-components
已支持
from vue-codemirror.
Related Issues (20)
- How to set lineNumbers as false?
- Uncaught TypeError: Cannot read properties of null (reading 'nextSibling')
- how to json for extensions?
- Can you add a language error message?
- No cursor when the content is empty
- When editing content, pressing the delete key once will delete two characters
- when change the input value, the doc of state does not update
- Expect to support the rules for editing logstash configuration files
- How to remove the gutter and lineNumber? HOT 3
- 如何可以配置针对一种语言高亮提示 HOT 1
- I successfully run the editor but when typing there is no code prompt that I want
- Multi-tab editor
- Could not find a declaration file for module 'codemirror'.
- Object(...) is not a function at eval (vue-codemirror.esm.js:7:1)
- sql repeat
- input long text not wrap HOT 1
- Vertical Scrollbar moves always to the middle HOT 3
- Highlighting the lines in editor HOT 1
- I defined two NPM Vue components and published them in the repository. There is no problem using it alone, but if it is referenced to a project, an error will be reported
- Cannot input spaces when used with other plugins
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-codemirror.