Files
nuttyreading-html/pages/yRead/edit.vue
@fawn-nine f8e1a3015b 1
2023-03-03 12:11:23 +08:00

43 lines
775 B
Vue

<template>
<view>
<editor id="editor" class="ql-container" :placeholder="placeholder" @ready="onEditorReady" @blur='result'></editor>
</view>
</template>
<script>
export default {
data() {
return {
placeholder: '开始输入...'
}
},
onLoad() {
},
methods: {
onEditorReady() {
// #ifdef MP-BAIDU
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editorId');
// #endif
// #ifdef APP-PLUS || H5 ||MP-WEIXIN
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
// #endif
},
undo() {
this.editorCtx.undo()
},
result(html, text, delta){
console.log(html.detail.html)
}
}
}
</script>
<style lang="less" scoped>
</style>