CodeDialog.vue 894 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <cus-dialog
  3. :visible="templateVisible"
  4. @on-close="templateVisible = false"
  5. ref="templateDialog"
  6. width="800px"
  7. form
  8. :title="$t('fm.config.widget.customTemplates')"
  9. @on-submit="handleSubmit"
  10. >
  11. <code-editor height="400px" :mode="this.mode" v-model="templ"></code-editor>
  12. </cus-dialog>
  13. </template>
  14. <script>
  15. import CusDialog from './CusDialog'
  16. import CodeEditor from './CodeEditor'
  17. export default {
  18. components: {
  19. CusDialog,
  20. CodeEditor
  21. },
  22. props: {
  23. mode: {
  24. type: String,
  25. default: 'xml'
  26. }
  27. },
  28. data () {
  29. return {
  30. templateVisible: false,
  31. templ: ''
  32. }
  33. },
  34. methods: {
  35. handleSubmit () {
  36. this.$emit('on-confirm', this.templ)
  37. },
  38. open (val) {
  39. this.templ = val
  40. this.templateVisible = true
  41. },
  42. close () {
  43. this.templateVisible = false
  44. }
  45. }
  46. }
  47. </script>