From 1f39b38bede0499dcace2da68cf4811476cd3d0e Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 30 Jul 2024 10:36:08 +0800 Subject: [PATCH] * [bug#53275] adjust copy btn event for instance. --- module/instance/js/view.ui.js | 22 +++++++--------------- module/instance/ui/view.html.php | 1 + 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/module/instance/js/view.ui.js b/module/instance/js/view.ui.js index 0da7694470..406d870784 100644 --- a/module/instance/js/view.ui.js +++ b/module/instance/js/view.ui.js @@ -59,25 +59,17 @@ function refreshStatus() }); } -$('.copy-btn').on('click', function() +window.copyText = function(dom) { - var copyText = $(this).parent().find('input'); + var copyText = $(dom).parent().find('input'); copyText.show(); copyText[0].select(); document.execCommand("Copy"); copyText.hide(); - var that = this; - $(that).tooltip - ({ - trigger: 'click', - placement: 'bottom', - title: copied, - tipClass: 'success', - show:true + zui.Messager.show({ + type: 'success', + content: copied, + time: 2000 }); - setTimeout(function() - { - $(that).tooltip('hide'); - }, 2000) -}) +} diff --git a/module/instance/ui/view.html.php b/module/instance/ui/view.html.php index 9be3675954..de71b67878 100644 --- a/module/instance/ui/view.html.php +++ b/module/instance/ui/view.html.php @@ -86,6 +86,7 @@ detailHeader( div ( setClass('flex flex-normal gap-x-5 justify-center'), + on::click('.copy-btn')->call('copyText', jsRaw('this')), div ( setClass('flex-none w-2/3'),