Editor.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <PageWrapper title="富文本嵌入表单示例">
  3. <CollapseContainer title="富文本表单">
  4. <BasicForm :labelWidth="100" :schemas="schemas" :actionColOptions="{ span: 24 }" @submit="handleSubmit" />
  5. </CollapseContainer>
  6. </PageWrapper>
  7. </template>
  8. <script lang="ts">
  9. import { defineComponent, h } from 'vue';
  10. import { BasicForm, FormSchema } from '/@/components/Form/index';
  11. import { CollapseContainer } from '/@/components/Container/index';
  12. import { useMessage } from '/@/hooks/web/useMessage';
  13. import { Tinymce } from '/@/components/Tinymce/index';
  14. import { PageWrapper } from '/@/components/Page';
  15. const schemas: FormSchema[] = [
  16. {
  17. field: 'title',
  18. component: 'Input',
  19. label: 'title',
  20. defaultValue: 'defaultValue',
  21. rules: [{ required: true }],
  22. },
  23. {
  24. field: 'tinymce',
  25. component: 'Input',
  26. label: 'tinymce',
  27. defaultValue: 'defaultValue',
  28. rules: [{ required: true }],
  29. render: ({ model, field }) => {
  30. return h(Tinymce, {
  31. value: model[field],
  32. onChange: (value: string) => {
  33. model[field] = value;
  34. },
  35. });
  36. },
  37. },
  38. ];
  39. export default defineComponent({
  40. components: { BasicForm, CollapseContainer, PageWrapper },
  41. setup() {
  42. const { createMessage } = useMessage();
  43. return {
  44. schemas,
  45. handleSubmit: (values: any) => {
  46. createMessage.success('click search,values:' + JSON.stringify(values));
  47. },
  48. };
  49. },
  50. });
  51. </script>