File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 11<script setup>
22import copy_text from ' ../utils/copy.js'
3- import alertify from ' alertifyjs'
4-
5- import { ref } from ' vue'
6-
3+ import { ref , onMounted } from ' vue'
74
85const props = defineProps ({
96 label: {
107 type: String ,
11- default: " 比特币地址:" // 默认值
8+ default: " 比特币地址:"
129 },
1310 text: {
1411 type: String ,
@@ -17,19 +14,26 @@ const props = defineProps({
1714})
1815
1916const copied = ref (false )
17+ // 用来存放客户端导入的 alertify
18+ let alertify = null
19+
20+ // 仅在浏览器端加载 alertifyjs
21+ onMounted (async () => {
22+ alertify = (await import (' alertifyjs' )).default
23+ })
24+
2025const handleCopy = () => {
2126 copy_text (props .text )
2227 .then (() => {
2328 copied .value = true
2429 setTimeout (() => (copied .value = false ), 2000 )
2530 console .log (' 复制成功:' , props .text )
26- alertify .success (' 复制成功!' )
31+ if (alertify) alertify .success (' 复制成功!' )
2732 })
2833 .catch (() => {
29- alertify .warning (' 复制失败~' )
34+ if (alertify) alertify .warning (' 复制失败~' )
3035 })
3136}
32-
3337 </script >
3438
3539<template >
You can’t perform that action at this time.
0 commit comments