2021-11-28 03:07:37 -08:00
|
|
|
<template>
|
2022-01-03 22:36:14 -08:00
|
|
|
<div class="alqyeyti" :class="{ oneline }">
|
2021-11-28 03:07:37 -08:00
|
|
|
<div class="key">
|
|
|
|
<slot name="key"></slot>
|
|
|
|
</div>
|
|
|
|
<div class="value">
|
|
|
|
<slot name="value"></slot>
|
2022-12-19 22:24:31 -08:00
|
|
|
<button v-if="copy" v-tooltip="i18n.ts.copy" class="_textButton" style="margin-left: 0.5em;" @click="copy_"><i class="ti ti-copy"></i></button>
|
2021-11-28 03:07:37 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-06-24 19:50:19 -07:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2021-11-28 03:07:37 -08:00
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
|
|
|
import * as os from '@/os';
|
2022-07-20 06:24:26 -07:00
|
|
|
import { i18n } from '@/i18n';
|
2021-11-28 03:07:37 -08:00
|
|
|
|
2022-06-24 19:50:19 -07:00
|
|
|
const props = withDefaults(defineProps<{
|
2022-06-28 22:19:40 -07:00
|
|
|
copy?: string | null;
|
|
|
|
oneline?: boolean;
|
2022-06-24 19:50:19 -07:00
|
|
|
}>(), {
|
|
|
|
copy: null,
|
|
|
|
oneline: false,
|
2021-11-28 03:07:37 -08:00
|
|
|
});
|
2022-06-24 19:50:19 -07:00
|
|
|
|
|
|
|
const copy_ = () => {
|
|
|
|
copyToClipboard(props.copy);
|
|
|
|
os.success();
|
|
|
|
};
|
2021-11-28 03:07:37 -08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.alqyeyti {
|
|
|
|
> .key {
|
|
|
|
font-size: 0.85em;
|
|
|
|
padding: 0 0 0.25em 0;
|
|
|
|
opacity: 0.75;
|
|
|
|
}
|
2022-01-03 22:36:14 -08:00
|
|
|
|
|
|
|
&.oneline {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
> .key {
|
|
|
|
width: 30%;
|
|
|
|
font-size: 1em;
|
|
|
|
padding: 0 8px 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .value {
|
|
|
|
width: 70%;
|
2022-06-24 19:50:19 -07:00
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2022-01-03 22:36:14 -08:00
|
|
|
}
|
|
|
|
}
|
2021-11-28 03:07:37 -08:00
|
|
|
}
|
|
|
|
</style>
|