Editor.vue 1.6 KB

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