mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-01-25 00:51:28 +08:00
fix(mac-address-lookup): added copy handler on button click
This commit is contained in:
parent
74073f5038
commit
c311e3824d
1 changed files with 4 additions and 1 deletions
|
@ -24,7 +24,7 @@
|
|||
</n-form-item>
|
||||
|
||||
<n-space justify="center">
|
||||
<c-button :disabled="!details"> Copy vendor info </c-button>
|
||||
<c-button :disabled="!details" @click="copy"> Copy vendor info </c-button>
|
||||
</n-space>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -32,6 +32,7 @@
|
|||
<script setup lang="ts">
|
||||
import db from 'oui/oui.json';
|
||||
import { macAddressValidation } from '@/utils/macAddress';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
|
||||
const getVendorValue = (address: string) => address.trim().replace(/[.:-]/g, '').toUpperCase().substring(0, 6);
|
||||
|
||||
|
@ -39,6 +40,8 @@ const macAddress = ref('20:37:06:12:34:56');
|
|||
const details = computed<string | undefined>(() => db[getVendorValue(macAddress.value)]);
|
||||
|
||||
const { attrs: validationAttrs } = macAddressValidation(macAddress);
|
||||
|
||||
const { copy } = useCopy({ source: details, text: 'Vendor info copied to the clipboard' });
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
|
Loading…
Reference in a new issue