|
@@ -65,7 +65,7 @@
|
|
</a-input>
|
|
</a-input>
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
- import { ref, watchEffect, watch, unref } from 'vue';
|
|
|
|
|
|
+ import { ref, watchEffect, watch } from 'vue';
|
|
import { useDesign } from '/@/hooks/web/useDesign';
|
|
import { useDesign } from '/@/hooks/web/useDesign';
|
|
import { ScrollContainer } from '/@/components/Container';
|
|
import { ScrollContainer } from '/@/components/Container';
|
|
import { Input, Popover, Pagination, Empty } from 'ant-design-vue';
|
|
import { Input, Popover, Pagination, Empty } from 'ant-design-vue';
|
|
@@ -77,10 +77,8 @@
|
|
import { usePagination } from '/@/hooks/web/usePagination';
|
|
import { usePagination } from '/@/hooks/web/usePagination';
|
|
import { useDebounceFn } from '@vueuse/core';
|
|
import { useDebounceFn } from '@vueuse/core';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
- import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
|
|
- import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
import svgIcons from 'virtual:svg-icons-names';
|
|
import svgIcons from 'virtual:svg-icons-names';
|
|
-
|
|
|
|
|
|
+ import { copyText } from '/@/utils/copyTextToClipboard';
|
|
// 没有使用别名引入,是因为WebStorm当前版本还不能正确识别,会报unused警告
|
|
// 没有使用别名引入,是因为WebStorm当前版本还不能正确识别,会报unused警告
|
|
const AInput = Input;
|
|
const AInput = Input;
|
|
const APopover = Popover;
|
|
const APopover = Popover;
|
|
@@ -107,7 +105,7 @@
|
|
value: propTypes.string,
|
|
value: propTypes.string,
|
|
width: propTypes.string.def('100%'),
|
|
width: propTypes.string.def('100%'),
|
|
pageSize: propTypes.number.def(140),
|
|
pageSize: propTypes.number.def(140),
|
|
- copy: propTypes.bool.def(false),
|
|
|
|
|
|
+ copy: propTypes.bool.def(true),
|
|
mode: propTypes.oneOf<('svg' | 'iconify')[]>(['svg', 'iconify']).def('iconify'),
|
|
mode: propTypes.oneOf<('svg' | 'iconify')[]>(['svg', 'iconify']).def('iconify'),
|
|
});
|
|
});
|
|
|
|
|
|
@@ -125,17 +123,6 @@
|
|
|
|
|
|
const debounceHandleSearchChange = useDebounceFn(handleSearchChange, 100);
|
|
const debounceHandleSearchChange = useDebounceFn(handleSearchChange, 100);
|
|
|
|
|
|
- let clipboardRef;
|
|
|
|
- let isSuccessRef;
|
|
|
|
-
|
|
|
|
- if (props.copy) {
|
|
|
|
- const clipboard = useCopyToClipboard(props.value);
|
|
|
|
- clipboardRef = clipboard?.clipboardRef;
|
|
|
|
- isSuccessRef = clipboard?.isSuccessRef;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const { createMessage } = useMessage();
|
|
|
|
-
|
|
|
|
const { getPaginationList, getTotal, setCurrentPage } = usePagination(
|
|
const { getPaginationList, getTotal, setCurrentPage } = usePagination(
|
|
currentList,
|
|
currentList,
|
|
props.pageSize,
|
|
props.pageSize,
|
|
@@ -160,10 +147,7 @@
|
|
function handleClick(icon: string) {
|
|
function handleClick(icon: string) {
|
|
currentSelect.value = icon;
|
|
currentSelect.value = icon;
|
|
if (props.copy) {
|
|
if (props.copy) {
|
|
- clipboardRef.value = icon;
|
|
|
|
- if (unref(isSuccessRef)) {
|
|
|
|
- createMessage.success(t('component.icon.copy'));
|
|
|
|
- }
|
|
|
|
|
|
+ copyText(icon, t('component.icon.copy'));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|