mirror of
				https://github.com/MHSanaei/3x-ui.git
				synced 2025-10-27 02:24:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			No EOL
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			No EOL
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{define "textModal"}}
 | |
| <a-modal id="text-modal" v-model="txtModal.visible" :title="txtModal.title"
 | |
|          :closable="true" ok-text='{{ i18n "copy" }}' cancel-text='{{ i18n "close" }}'
 | |
|          :class="themeSwitcher.darkCardClass"
 | |
|          :ok-button-props="{attrs:{id:'txt-modal-ok-btn'}}">
 | |
|     <a-button v-if="!ObjectUtil.isEmpty(txtModal.fileName)" type="primary" style="margin-bottom: 10px;"
 | |
|               :href="'data:application/text;charset=utf-8,' + encodeURIComponent(txtModal.content)"
 | |
|               :download="txtModal.fileName">
 | |
|         {{ i18n "download" }} [[ txtModal.fileName ]]
 | |
|     </a-button>
 | |
|     <a-input type="textarea" v-model="txtModal.content"
 | |
|              :autosize="{ minRows: 10, maxRows: 20}"></a-input>
 | |
| </a-modal>
 | |
| 
 | |
| <script>
 | |
| 
 | |
|     const txtModal = {
 | |
|         title: '',
 | |
|         content: '',
 | |
|         fileName: '',
 | |
|         qrcode: null,
 | |
|         clipboard: null,
 | |
|         visible: false,
 | |
|         show: function (title = '', content = '', fileName = '') {
 | |
|             this.title = title;
 | |
|             this.content = content;
 | |
|             this.fileName = fileName;
 | |
|             this.visible = true;
 | |
|             textModalApp.$nextTick(() => {
 | |
|                 if (this.clipboard === null) {
 | |
|                     this.clipboard = new ClipboardJS('#txt-modal-ok-btn', {
 | |
|                         text: () => this.content,
 | |
|                     });
 | |
|                     this.clipboard.on('success', () => app.$message.success('{{ i18n "copied" }}'));
 | |
|                 }
 | |
|             });
 | |
|         },
 | |
|         close: function () {
 | |
|             this.visible = false;
 | |
|         },
 | |
|     };
 | |
| 
 | |
|     const textModalApp = new Vue({
 | |
|         delimiters: ['[[', ']]'],
 | |
|         el: '#text-modal',
 | |
|         data: {
 | |
|             txtModal: txtModal,
 | |
|         },
 | |
|     });
 | |
| 
 | |
| </script>
 | |
| {{end}} | 
