73 lines
1.9 KiB
Vue
73 lines
1.9 KiB
Vue
<template>
|
|
<view class="richtext" style="height: 100%;">
|
|
|
|
<piaoyiEditor :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> |