add.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <script>
  2. // import editor from "@ckeditor/ckeditor5-build-classic";
  3. // import "@ckeditor/ckeditor5-build-classic/build/translations/ja.js";
  4. // import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
  5. // Vue.use( CKEditor );
  6. import RoundedTitle from "../../../components/public/roundedTitle.vue";
  7. import PopCard from "../../../components/public/popCard.vue";
  8. import ImageTable from "../../../components/public/imageTable.vue";
  9. import Pop from "../../../components/public/pop.vue";
  10. let ClassicEditor;
  11. if (process.client) {
  12. ClassicEditor = require('@ckeditor/ckeditor5-build-classic')
  13. }
  14. export default {
  15. name: "add",
  16. components: {
  17. Pop,
  18. ImageTable,
  19. PopCard,
  20. RoundedTitle
  21. // Use the <ckeditor> component in this view.
  22. },
  23. data(){
  24. return {
  25. editor: ClassicEditor,
  26. editorData: '<p>文章内容</p>',
  27. editorConfig: {
  28. language: "zh-cn"
  29. },
  30. imagePopShow: false,
  31. imagePopLoading: false,
  32. }
  33. },
  34. methods:{
  35. okHandle(fileData){
  36. console.log('okHandle');
  37. console.log(fileData);
  38. this.imagePopShow = false;
  39. // this.$refs.ckeditor.editor.execute('imageInsert', {
  40. // source: fileData.url,
  41. // alt: fileData.name
  42. // });
  43. },
  44. }
  45. }
  46. </script>
  47. <template>
  48. <div class="w-full p-2">
  49. <rounded-title class="text-xl">
  50. <span>新增文章</span>
  51. <a href="/manger/news"
  52. class="px-10 h-full ml-5 rounded bg-blue-400 text-white cursor-pointer
  53. hover:text-orange-500 ">文章中心</a>
  54. </rounded-title>
  55. <div class="page-content-box w-full mt-2 p-0.5 rounded bg-white">
  56. <a-button @click="imagePopShow = true">插入图片</a-button>
  57. <ckeditor ref="ckeditor" :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
  58. </div>
  59. <pop :show="imagePopShow" :loading="imagePopLoading">
  60. <image-table
  61. class="w-full h-full"
  62. @
  63. @ok="okHandle">
  64. </image-table>
  65. </pop>
  66. </div>
  67. </template>
  68. <style scoped>
  69. .page-content-box{
  70. min-height: 500px;
  71. }
  72. </style>