Commit a4ca74e9ab87a233686442eb27b98ff839901af1

Authored by fengtao
1 parent 5860e087

fix:DEFECT-858 复制Topic一次后,第二次就复制不上了

... ... @@ -47,8 +47,8 @@
47 47 </div>
48 48 </BasicModal>
49 49 </div>
50   - <Description @register="register" class="mt-4" :data="deviceDetail" />
51   - </div>
  50 + <Description @register="register" class="mt-4" :data="deviceDetail" /> </div
  51 + >设备Topic
52 52 <div class="mt-4">
53 53 <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button>
54 54 <a-button type="primary" class="mr-4" @click="copyDeviceToken">复制访问令牌</a-button>
... ... @@ -75,6 +75,7 @@
75 75 import { Description, useDescription } from '/@/components/Description';
76 76 import { QuestionCircleOutlined } from '@ant-design/icons-vue';
77 77 import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
  78 + import { useClipboard } from '@vueuse/core';
78 79
79 80 import wz from '/@/assets/images/wz.png';
80 81 export default defineComponent({
... ... @@ -154,10 +155,10 @@
154 155 const token = await getDeviceToken(props.deviceDetail.tbDeviceId);
155 156 openModal(true, token);
156 157 };
157   - const copyTopic = (value) => {
158   - clipboardRef.value = value;
159   - console.log(clipboardRef.value);
160   - createMessage.success('复制成功~');
  158 + const { copy } = useClipboard();
  159 + const copyTopic = (val) => {
  160 + copy(val);
  161 + createMessage.success('复制成功!');
161 162 };
162 163
163 164 const [registerTopicModal, { openModal: openTopicModal }] = useModal();
... ...