ueditor.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. np<template>
  2. <div>
  3. <script :id="uuid" type="text/plain" ></script>
  4. </div>
  5. </template>
  6. <script>
  7. import '../../../public/ueditor-1.4.3.3/ueditor.config.js'
  8. import '../../../public/ueditor-1.4.3.3/ueditor.all.min.js'
  9. import '../../../public/ueditor-1.4.3.3/lang/zh-cn/zh-cn.js'
  10. import '../../../public/ueditor-1.4.3.3/jquery-2.2.3.min.js'
  11. export default {
  12. name: "UEditor",
  13. props: {
  14. id: {
  15. type: String
  16. },
  17. config: {
  18. type: Object
  19. }
  20. },
  21. data() {
  22. return {
  23. editor: null,
  24. uuid:`J_ueditorBox_${new Date().getTime()}`
  25. }
  26. },
  27. mounted() {
  28. //初始化UE
  29. const _this = this;
  30. this.editor = UE.delEditor(this.uuid);
  31. this.editor = UE.getEditor(this.uuid,this.config);
  32. },
  33. destoryed() {
  34. this.editor.destory();
  35. },
  36. methods:{
  37. getUEContent: function(){
  38. return this.editor.getContent();
  39. },
  40. getContentTxt: function(){
  41. return this.editor.getContentTxt();
  42. }
  43. }
  44. }
  45. </script>