UeditorOne.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <textarea v-bind:id="'container'+name"
  3. style="width:0;height:0.5px;border: 0 solid rgba(255,255,255,0);resize:none;padding:0;outline:none;"
  4. v-model="content_ue"
  5. :name="name ? name : 'ue'">{{content_ue}}</textarea>
  6. </template>
  7. <style scoped>
  8. #ueditor_textarea_content {
  9. width:0;
  10. height:0.5px;
  11. border: 0 solid rgba(255,255,255,0);
  12. display: block;
  13. }
  14. </style>
  15. <script>
  16. export default {
  17. props: ['label','name','value','configs','width','height','enabled'],
  18. data() {
  19. return {
  20. content_ue: this._props.value ? this._props.value : ''
  21. };
  22. },
  23. mounted() {
  24. var configs = this._props.configs ? this._props.configs : {
  25. initialFrameWidth: this._props.width ? this._props.width : 1000 , //> 编辑器默认宽度
  26. initialFrameHeight: this._props.height ? this._props.height : 550, //> 编辑器默认高度
  27. autoFloatEnabled: this._props.enabled ? false : true //> 编辑器默认页头浮动
  28. };
  29. UE.delEditor('container'+this._props.name);
  30. var vm_ue=this;
  31. var ue = UE.getEditor('container'+this._props.name,configs);
  32. ue.addListener("contentChange", function () {
  33. var content = ue.getContent();
  34. console.log(content);
  35. vm_ue.$emit('set-keys',content);
  36. });
  37. //ue.ready(function(){
  38. //> 设置编辑器回显内容
  39. //ue.setContent(parents.editContent);
  40. //});
  41. },
  42. watch:{
  43. 'content_ue':function () {
  44. console.log(this.content_ue);
  45. this.$emit('set-keys',this.content_ue);
  46. },
  47. }
  48. }
  49. </script>