8b07880643efec6c44bdb789d13806e3dec22e7b.svn-base 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <a-popover trigger="contextmenu" v-model="visible" :placement="position" overlayClassName="j-input-pop">
  3. <!--"(node) => node.parentNode.parentNode"-->
  4. <div slot="title">
  5. <span>{{ title }}</span>
  6. <span style="float: right" title="关闭">
  7. <a-icon type="close" @click="visible=false"/>
  8. </span>
  9. </div>
  10. <a-input :value="inputContent" :disabled="disabled" @change="handleInputChange">
  11. <a-icon slot="suffix" type="fullscreen" @click.stop="pop" />
  12. </a-input>
  13. <div slot="content">
  14. <j-code-editor
  15. language="javascript"
  16. v-model="inputContent"
  17. :fullScreen="true"
  18. :style="{ minHeight: height + 'px', minWidth: width + 'px'}"
  19. />
  20. </div>
  21. </a-popover>
  22. </template>
  23. <script>
  24. import JCodeEditor from '@/components/jeecg/JCodeEditor'
  25. export default {
  26. name: 'JCodeEditorPop',
  27. components: {
  28. JCodeEditor
  29. },
  30. props: {
  31. title: {
  32. type: String,
  33. default: '',
  34. required: false
  35. },
  36. position: {
  37. type: String,
  38. default: 'right',
  39. required: false
  40. },
  41. height: {
  42. type: Number,
  43. default: 200,
  44. required: false
  45. },
  46. width: {
  47. type: Number,
  48. default: 500,
  49. required: false
  50. },
  51. value: {
  52. type: String,
  53. required: false
  54. },
  55. popContainer: {
  56. type: String,
  57. default: '',
  58. required: false
  59. },
  60. disabled: {
  61. type: Boolean,
  62. default: false
  63. }
  64. },
  65. data() {
  66. return {
  67. visible: false,
  68. inputContent: ''
  69. }
  70. },
  71. watch: {
  72. value: {
  73. immediate: true,
  74. handler: function() {
  75. if (this.value && this.value.length > 0) {
  76. this.inputContent = this.value
  77. }
  78. }
  79. },
  80. inputContent(value) {
  81. this.$emit('change', value)
  82. }
  83. },
  84. model: {
  85. prop: 'value',
  86. event: 'change'
  87. },
  88. methods: {
  89. handleInputChange(event) {
  90. this.inputContent = event.target.value
  91. this.$emit('change', this.inputContent)
  92. },
  93. pop() {
  94. this.visible = true
  95. },
  96. getPopupContainer(node) {
  97. if (!this.popContainer) {
  98. return node.parentNode
  99. } else {
  100. return document.getElementById(this.popContainer)
  101. }
  102. }
  103. }
  104. }
  105. </script>
  106. <style scoped>
  107. </style>