text_modal.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {{define "modals/textModal"}}
  2. <a-modal id="text-modal" v-model="txtModal.visible" :title="txtModal.title" :closable="true"
  3. :class="themeSwitcher.currentTheme">
  4. <a-input :style="{ overflowY: 'auto' }" type="textarea" v-model="txtModal.content"
  5. :autosize="{ minRows: 10, maxRows: 20}"></a-input>
  6. <template slot="footer">
  7. <a-button v-if="!ObjectUtil.isEmpty(txtModal.fileName)" icon="download"
  8. @click="FileManager.downloadTextFile(txtModal.content, txtModal.fileName)">
  9. <span>[[ txtModal.fileName ]]</span>
  10. </a-button>
  11. <a-button type="primary" icon="copy" @click="txtModal.copy(txtModal.content)">
  12. <span>{{ i18n "copy" }}</span>
  13. </a-button>
  14. </template>
  15. </a-modal>
  16. <script>
  17. const txtModal = {
  18. title: '',
  19. content: '',
  20. fileName: '',
  21. qrcode: null,
  22. visible: false,
  23. show: function (title = '', content = '', fileName = '') {
  24. this.title = title;
  25. this.content = content;
  26. this.fileName = fileName;
  27. this.visible = true;
  28. },
  29. copy: function (content = '') {
  30. ClipboardManager
  31. .copyText(content)
  32. .then(() => {
  33. app.$message.success('{{ i18n "copied" }}')
  34. this.close();
  35. })
  36. },
  37. close: function () {
  38. this.visible = false;
  39. },
  40. };
  41. const textModalApp = new Vue({
  42. delimiters: ['[[', ']]'],
  43. el: '#text-modal',
  44. data: {
  45. txtModal: txtModal,
  46. },
  47. });
  48. </script>
  49. {{end}}