node.js - 如何让 Redactor 所见即所得与 vue.js 一起工作(没有 jQuery)
问题描述
根据网站 ( https://imperavi.com/redactor/ ),当前版本的 redactor 是免费的 jquery。(引自页面“jQuery Free 没有依赖,没有问题”。
我可以让编辑器进入 vue.js,但我不确定如何通过事件绑定数据(因为它没有出现,您可以直接绑定)。
从https://imperavi.com/redactor/docs/callbacks/source/获取想法
我已经尝试过我页面的脚本部分)
window.onload = function () {
window.Redactor('#redactor1', {
callbacks: {
source: {
changed: function (html) {
alert('aa')
return html
}
},
syncBefore: function (html) {
alert('bb')
return html
}
}
})
alert("It's loaded!")
}
但它似乎并没有触发事件 - 除了 alert("it's loaded") 工作正常。也没有错误。
任何想法我做错了什么?
解决方案
You can use inspiration from their Vue plugin: https://github.com/imperavi/vue-redactor
watch: {
value(newValue, oldValue)
{
if (!this.redactor.editor.isFocus()) this.redactor.source.setCode(newValue)
}
},
推荐阅读
- php - 插入电源后,PHP SESSION 在 iPad 上死机。铬应用
- java - 在 Ubuntu 中执行 Jmeter 脚本,遇到错误
- javascript - 当我们不知道数据的嵌套级别时,如何在 react/redux 的 reducer 状态属性中更新数据?
- android - firebase 数据库更改时向应用程序用户(android)推送通知?
- qt - 如何不在控制台上打印 Qt 内部消息?
- jspdf - jsPDF - 在所有页面的页脚中打印当前页码
- machine-learning - Spark ML 错误:编号不正确。使用线性 SVC 时检测到的类
- symfony - Symfony 重定向所有匹配主机的路由
- continuous-integration - TeamCity - MSBuild 不正确的构建顺序
- java - Internet Explorer 11 中的 RedHat OpenJDK 8 小程序