Files
taimed/pages/articleList/common-editor.vue
liuyuan 0d0bf4bb3a tijiao
2025-09-04 13:55:23 +08:00

73 lines
2.0 KiB
Vue

<template>
<view class="richtext" style="height: 100%;">
<piaoyiEditor :toolbarTop="`${48 + statusBarHeight}px`" :height="height" :placeholder="placeholder" :values="values" @changes="saveContens" :readOnly="readOnly" :photoUrl="photoUrl" :api="api" :name="name"/>
</view>
</template>
<script>
import piaoyiEditor from '@/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue';
export default {
props: {
content: {
type: String,
default: ''
},
placeholder: {
type: String,
default: ''
},
readOnly: {
type: Boolean,
default: false
},
height: {
type: String,
default: ''
},
},
data() {
return {
photoUrl: 'https://api.nuttyreading.com', //服务器图片域名或者ip
api: '/oss/fileoss', //上传图片接口地址
txt: '',
name: 'file',
values: ''
};
},
components: {
piaoyiEditor
},
methods: {
saveContens(e) {
this.txt = e.html
this.$emit('saveContens', this.txt)
}
},
onShareAppMessage(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '多功能富文本编辑器!',
path: '/pages/editor/editor'
}
},
onShareTimeline(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '多功能富文本编辑器!'
}
}
}
</script>
<style lang="scss">
</style>