Commit cc3796041e4021ef81737af2a2b8a87ab6b530d3
Merge branch 'dev-fix-ww' into 'main_dev'
fix: DEFECT-1272 修复复制失效问题 See merge request yunteng/thingskit-front!587
Showing
3 changed files
with
15 additions
and
15 deletions
@@ -27,9 +27,9 @@ | @@ -27,9 +27,9 @@ | ||
27 | import { ShareModal } from '/@/views/common/ShareModal'; | 27 | import { ShareModal } from '/@/views/common/ShareModal'; |
28 | import { ViewTypeNameEnum } from '../../common/ShareModal/config'; | 28 | import { ViewTypeNameEnum } from '../../common/ShareModal/config'; |
29 | import { useModal } from '/@/components/Modal'; | 29 | import { useModal } from '/@/components/Modal'; |
30 | - import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | ||
31 | import { ViewType } from '../../visual/board/config/panelDetail'; | 30 | import { ViewType } from '../../visual/board/config/panelDetail'; |
32 | import { useRole } from '/@/hooks/business/useRole'; | 31 | import { useRole } from '/@/hooks/business/useRole'; |
32 | + import { useClipboard } from '@vueuse/core'; | ||
33 | 33 | ||
34 | const listColumn = ref(5); | 34 | const listColumn = ref(5); |
35 | 35 | ||
@@ -167,12 +167,12 @@ | @@ -167,12 +167,12 @@ | ||
167 | return `${origin}${configurationPrefix}/?${searchParams.toString()}`; | 167 | return `${origin}${configurationPrefix}/?${searchParams.toString()}`; |
168 | }; | 168 | }; |
169 | 169 | ||
170 | - const { clipboardRef, isSuccessRef } = useCopyToClipboard(); | ||
171 | - const handleCreateShareUrl = (record: ConfigurationCenterItemsModal) => { | 170 | + const { copied, copy } = useClipboard(); |
171 | + const handleCreateShareUrl = async (record: ConfigurationCenterItemsModal) => { | ||
172 | if (!unref(getShareFlag)) return; | 172 | if (!unref(getShareFlag)) return; |
173 | const url = createShareUrl(record); | 173 | const url = createShareUrl(record); |
174 | - clipboardRef.value = url; | ||
175 | - if (unref(isSuccessRef)) { | 174 | + await copy(url); |
175 | + if (unref(copied)) { | ||
176 | createMessage.success('复制成功~'); | 176 | createMessage.success('复制成功~'); |
177 | } | 177 | } |
178 | }; | 178 | }; |
@@ -28,11 +28,11 @@ | @@ -28,11 +28,11 @@ | ||
28 | import { useModal } from '/@/components/Modal'; | 28 | import { useModal } from '/@/components/Modal'; |
29 | import { ShareModal } from '/@/views/common/ShareModal'; | 29 | import { ShareModal } from '/@/views/common/ShareModal'; |
30 | import { ViewTypeNameEnum } from '../common/ShareModal/config'; | 30 | import { ViewTypeNameEnum } from '../common/ShareModal/config'; |
31 | - import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | ||
32 | import { ViewType } from '../visual/board/config/panelDetail'; | 31 | import { ViewType } from '../visual/board/config/panelDetail'; |
33 | import { useUserStore } from '/@/store/modules/user'; | 32 | import { useUserStore } from '/@/store/modules/user'; |
34 | import { RoleEnum } from '/@/enums/roleEnum'; | 33 | import { RoleEnum } from '/@/enums/roleEnum'; |
35 | import { useRole } from '/@/hooks/business/useRole'; | 34 | import { useRole } from '/@/hooks/business/useRole'; |
35 | + import { useClipboard } from '@vueuse/core'; | ||
36 | 36 | ||
37 | const listColumn = ref(5); | 37 | const listColumn = ref(5); |
38 | 38 | ||
@@ -182,10 +182,10 @@ | @@ -182,10 +182,10 @@ | ||
182 | return userStore.getUserInfo.roles![0] !== RoleEnum.CUSTOMER_USER; | 182 | return userStore.getUserInfo.roles![0] !== RoleEnum.CUSTOMER_USER; |
183 | }); | 183 | }); |
184 | 184 | ||
185 | - const { clipboardRef, isSuccessRef } = useCopyToClipboard(); | ||
186 | - const handleCreateShareUrl = (record: BigScreenCenterItemsModel) => { | ||
187 | - clipboardRef.value = createShareUrl(record); | ||
188 | - if (unref(isSuccessRef)) { | 185 | + const { copied, copy } = useClipboard(); |
186 | + const handleCreateShareUrl = async (record: BigScreenCenterItemsModel) => { | ||
187 | + await copy(createShareUrl(record)); | ||
188 | + if (unref(copied)) { | ||
189 | createMessage.success('复制成功~'); | 189 | createMessage.success('复制成功~'); |
190 | } | 190 | } |
191 | }; | 191 | }; |
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | import { onMounted, ref, unref } from 'vue'; | 3 | import { onMounted, ref, unref } from 'vue'; |
4 | import { PageWrapper } from '/@/components/Page'; | 4 | import { PageWrapper } from '/@/components/Page'; |
5 | import { MoreOutlined, ShareAltOutlined } from '@ant-design/icons-vue'; | 5 | import { MoreOutlined, ShareAltOutlined } from '@ant-design/icons-vue'; |
6 | - import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | ||
7 | import { useMessage } from '/@/hooks/web/useMessage'; | 6 | import { useMessage } from '/@/hooks/web/useMessage'; |
8 | import Dropdown from '/@/components/Dropdown/src/Dropdown.vue'; | 7 | import Dropdown from '/@/components/Dropdown/src/Dropdown.vue'; |
9 | import { DropMenu } from '/@/components/Dropdown'; | 8 | import { DropMenu } from '/@/components/Dropdown'; |
@@ -25,6 +24,7 @@ | @@ -25,6 +24,7 @@ | ||
25 | import { ModalParamsType } from '/#/utils'; | 24 | import { ModalParamsType } from '/#/utils'; |
26 | import { DataActionModeEnum } from '/@/enums/toolEnum'; | 25 | import { DataActionModeEnum } from '/@/enums/toolEnum'; |
27 | import { useRole } from '/@/hooks/business/useRole'; | 26 | import { useRole } from '/@/hooks/business/useRole'; |
27 | + import { useClipboard } from '@vueuse/core'; | ||
28 | 28 | ||
29 | const ListItem = List.Item; | 29 | const ListItem = List.Item; |
30 | const router = useRouter(); | 30 | const router = useRouter(); |
@@ -87,10 +87,10 @@ | @@ -87,10 +87,10 @@ | ||
87 | return `${origin}${DATA_BOARD_SHARE_URL(id, publicId)}`; | 87 | return `${origin}${DATA_BOARD_SHARE_URL(id, publicId)}`; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | - const { clipboardRef } = useCopyToClipboard(); | ||
91 | - const handleCopyShareUrl = (record: DataBoardRecord) => { | ||
92 | - clipboardRef.value = createShareUrl(record); | ||
93 | - unref(clipboardRef) ? createMessage.success('复制成功') : createMessage.error('未找到分享链接'); | 90 | + const { copied, copy } = useClipboard(); |
91 | + const handleCopyShareUrl = async (record: DataBoardRecord) => { | ||
92 | + await copy(createShareUrl(record)); | ||
93 | + unref(copied) ? createMessage.success('复制成功') : createMessage.error('未找到分享链接'); | ||
94 | }; | 94 | }; |
95 | 95 | ||
96 | const { isCustomerUser } = useRole(); | 96 | const { isCustomerUser } = useRole(); |