This commit is contained in:
神仙都没用 2025-03-20 16:57:21 +08:00
parent c38741aa05
commit 3fa10fb269
8 changed files with 56 additions and 41 deletions

View File

@ -16,13 +16,13 @@
body, body,
#app { #app {
height: 100%; height: 100%;
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
} }
* { * {
margin: 0; -webkit-font-smoothing: antialiased;
padding: 0; font-family:
'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
} }
.preload__wrap { .preload__wrap {

View File

@ -7,7 +7,7 @@
effect="dark" effect="dark"
> >
<template #reference> <template #reference>
<span class="text">{{ text }}</span> <span class="cl-code-json__text">{{ text }}</span>
</template> </template>
<viewer /> <viewer />
@ -33,7 +33,8 @@ import { computed, defineComponent } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
const props = defineProps({ const props = defineProps({
modelValue: [String, Object], content: null,
modelValue: null,
popover: Boolean, popover: Boolean,
height: { height: {
type: [Number, String], type: [Number, String],
@ -42,7 +43,8 @@ const props = defineProps({
maxHeight: { maxHeight: {
type: [Number, String], type: [Number, String],
default: 300 default: 300
} },
title: String
}); });
const { copy } = useClipboard(); const { copy } = useClipboard();
@ -50,14 +52,14 @@ const { t } = useI18n();
// //
const text = computed(() => { const text = computed(() => {
const v = props.modelValue; const v = props.modelValue || props.content;
if (isString(v)) { if (isString(v)) {
return v; return v;
} else if (isObject(v)) { } else if (isObject(v)) {
return JSON.stringify(v, null, 4); return JSON.stringify(v, null, 4);
} else { } else {
return ''; return String(v);
} }
}); });
@ -72,16 +74,20 @@ const viewer = defineComponent({
return () => { return () => {
return ( return (
<div class="cl-code-json"> <div class="cl-code-json">
<div class="op"> <div class="cl-code-json__op">
<el-button type="success" size="small" onClick={toCopy}> {text.value != '{}' && (
{t('复制')} <el-button type="success" size="small" onClick={toCopy}>
</el-button> {t('复制')}
</el-button>
)}
{slots.op && slots.op()} {slots.op && slots.op()}
</div> </div>
{props.title && <div class="cl-code-json__title">{props.title}</div>}
<el-scrollbar <el-scrollbar
class="scrollbar" class="cl-code-json__content"
max-height={props.maxHeight} max-height={props.maxHeight}
height={props.height} height={props.height}
> >
@ -101,25 +107,35 @@ const viewer = defineComponent({
position: relative; position: relative;
min-width: 200px; min-width: 200px;
max-width: 500px; max-width: 500px;
font-size: 14px;
.op { &__op {
position: absolute; position: absolute;
right: 8px; right: 8px;
top: 8px; top: 8px;
z-index: 9; z-index: 9;
} }
.scrollbar { &__title {
padding: 10px;
font-size: 12px;
color: var(--el-text-color-regular);
& + .cl-code-json__content {
padding-top: 0;
}
}
&__content {
padding: 10px;
code { code {
display: block;
padding: 10px;
font-size: 14px;
white-space: pre-wrap; white-space: pre-wrap;
} }
} }
&__wrap { &__wrap {
.text { .cl-code-json__text {
display: block; display: block;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;

View File

@ -54,7 +54,7 @@ export default defineComponent({
const item = (e: Menu.Item) => { const item = (e: Menu.Item) => {
const arr = [ const arr = [
<cl-svg name={e.icon} size={16} />, <cl-svg name={e.icon} size={18} />,
<span class="ml-4 tracking-wider text-[14px] mr-auto text-ellipsis overflow-hidden whitespace-nowrap"> <span class="ml-4 tracking-wider text-[14px] mr-auto text-ellipsis overflow-hidden whitespace-nowrap">
{e.meta?.label} {e.meta?.label}
</span> </span>

View File

@ -25,7 +25,7 @@
@click="onTap(item, Number(index))" @click="onTap(item, Number(index))"
@contextmenu.stop.prevent="openCM($event, item)" @contextmenu.stop.prevent="openCM($event, item)"
> >
<span class="label tracking-wider text-[12px]"> <span class="label tracking-wider">
{{ item.meta.label || item.name || item.path }} {{ item.meta.label || item.name || item.path }}
</span> </span>
@ -209,7 +209,7 @@ onMounted(() => {
height: 100%; height: 100%;
flex: 1; flex: 1;
position: relative; position: relative;
margin: 0 10px; margin: 0 5px;
} }
&__scroller { &__scroller {
@ -229,8 +229,9 @@ onMounted(() => {
padding: 0 8px; padding: 0 8px;
cursor: pointer; cursor: pointer;
color: var(--el-text-color-regular); color: var(--el-text-color-regular);
border-radius: 4px; border-radius: var(--el-border-radius-base);
margin-right: 5px; margin-right: 5px;
border: 1px solid var(--el-fill-color-dark);
.close { .close {
width: 0; width: 0;
@ -245,6 +246,11 @@ onMounted(() => {
} }
} }
.label {
font-size: 12px;
line-height: 1;
}
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
} }
@ -255,6 +261,7 @@ onMounted(() => {
&.active { &.active {
background-color: var(--el-color-primary); background-color: var(--el-color-primary);
border-color: var(--el-color-primary);
color: #fff; color: #fff;
} }

View File

@ -7,7 +7,7 @@
<template v-else> <template v-else>
<el-breadcrumb :separator-icon="ArrowRightBold"> <el-breadcrumb :separator-icon="ArrowRightBold">
<el-breadcrumb-item v-for="(item, index) in list" :key="index"> <el-breadcrumb-item v-for="(item, index) in list" :key="index">
<span class="text-[13px]">{{ item.meta?.label || item.name }}</span> <span class="text-[14px]">{{ item.meta?.label || item.name }}</span>
</el-breadcrumb-item> </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</template> </template>

View File

@ -144,7 +144,7 @@ const keyWord = ref('');
} }
&:not(&--popup) { &:not(&--popup) {
--el-menu-base-level-padding: 24px; --el-menu-base-level-padding: 23px;
.el-menu-item, .el-menu-item,
.el-sub-menu__title { .el-sub-menu__title {

View File

@ -1,6 +1,5 @@
<template> <template>
<div class="cl-comm__icon" @click="toCode"> <div class="cl-comm__icon" @click="toCode">
<cl-svg name="quick" class="icon" />
<div class="t1">{{ $t('AI极速编码') }}</div> <div class="t1">{{ $t('AI极速编码') }}</div>
<div class="t2">Start</div> <div class="t2">Start</div>
</div> </div>
@ -21,12 +20,7 @@ function toCode() {
width: auto; width: auto;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
width: 120px; width: 90px;
.icon {
position: absolute;
left: 8px;
}
.t1, .t1,
.t2 { .t2 {
@ -37,11 +31,10 @@ function toCode() {
letter-spacing: 1px; letter-spacing: 1px;
position: absolute; position: absolute;
width: 100%; width: 100%;
padding-left: 18px;
top: 50%; top: 50%;
left: 0; left: 0;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(to right, #9f9f9f 0, #fff 10%, #868686 20%); background: linear-gradient(to right, #9f9f9f 0, #fff 10%, #666 20%);
background-position: 0; background-position: 0;
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
@ -49,7 +42,6 @@ function toCode() {
animation-fill-mode: forwards; animation-fill-mode: forwards;
-webkit-text-size-adjust: none; -webkit-text-size-adjust: none;
font-size: 12px; font-size: 12px;
line-height: 1;
} }
.t2 { .t2 {
@ -57,10 +49,6 @@ function toCode() {
} }
&:hover { &:hover {
.icon {
color: var(--el-color-primary);
}
.t1 { .t1 {
top: -100%; top: -100%;
} }
@ -76,7 +64,7 @@ function toCode() {
background-position: 0; background-position: 0;
} }
100% { 100% {
background-position: 100px; background-position: 90px;
} }
} }
</style> </style>

View File

@ -14,6 +14,10 @@
&__item { &__item {
padding: var(--cl-select-button-padding) !important; padding: var(--cl-select-button-padding) !important;
border-radius: var(--cl-select-button-radius) !important; border-radius: var(--cl-select-button-radius) !important;
&-label {
line-height: unset;
}
} }
} }