mirror of https://github.com/halo-dev/halo
refactor: adjust max width of post title field (#7564)
#### What type of PR is this? /area ui /kind improvement /milestone 2.21.x #### What this PR does / why we need it: before: <img width="552" alt="image" src="https://github.com/user-attachments/assets/679a0b38-e215-4fb8-bee6-737504e03a7f" /> after: <img width="696" alt="image" src="https://github.com/user-attachments/assets/7106c351-97ab-4a3c-978d-cfd9f8c20392" /> #### Which issue(s) this PR fixes: Fixes #7561 #### Does this PR introduce a user-facing change? ```release-note 调整 Console 文章列表的标题区域最大宽度 ```pull/7586/head
parent
1e5958dd5c
commit
4ca0a09281
|
@ -321,7 +321,10 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VEntityField>
|
</VEntityField>
|
||||||
<VEntityField :title="singlePage.page.spec.title">
|
<VEntityField
|
||||||
|
:title="singlePage.page.spec.title"
|
||||||
|
max-width="30rem"
|
||||||
|
>
|
||||||
<template #description>
|
<template #description>
|
||||||
<VSpace>
|
<VSpace>
|
||||||
<span class="text-xs text-gray-500">
|
<span class="text-xs text-gray-500">
|
||||||
|
|
|
@ -32,6 +32,7 @@ const externalUrl = computed(() => {
|
||||||
name: 'SinglePageEditor',
|
name: 'SinglePageEditor',
|
||||||
query: { name: singlePage.page.metadata.name },
|
query: { name: singlePage.page.metadata.name },
|
||||||
}"
|
}"
|
||||||
|
max-width="30rem"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<VSpace>
|
<VSpace>
|
||||||
|
|
|
@ -330,7 +330,7 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VEntityField>
|
</VEntityField>
|
||||||
<VEntityField :title="post.post.spec.title">
|
<VEntityField :title="post.post.spec.title" max-width="30rem">
|
||||||
<template #description>
|
<template #description>
|
||||||
<div class="flex flex-col gap-1.5">
|
<div class="flex flex-col gap-1.5">
|
||||||
<VSpace class="flex-wrap !gap-y-1">
|
<VSpace class="flex-wrap !gap-y-1">
|
||||||
|
|
|
@ -33,6 +33,7 @@ const externalUrl = computed(() => {
|
||||||
name: 'PostEditor',
|
name: 'PostEditor',
|
||||||
query: { name: post.post.metadata.name },
|
query: { name: post.post.metadata.name },
|
||||||
}"
|
}"
|
||||||
|
max-width="30rem"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<VSpace>
|
<VSpace>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue";
|
import { computed, type CSSProperties } from "vue";
|
||||||
import type { RouteLocationRaw } from "vue-router";
|
import type { RouteLocationRaw } from "vue-router";
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
@ -8,12 +8,14 @@ const props = withDefaults(
|
||||||
description?: string;
|
description?: string;
|
||||||
route?: RouteLocationRaw;
|
route?: RouteLocationRaw;
|
||||||
width?: string | number;
|
width?: string | number;
|
||||||
|
maxWidth?: string | number;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
title: undefined,
|
title: undefined,
|
||||||
description: undefined,
|
description: undefined,
|
||||||
route: undefined,
|
route: undefined,
|
||||||
width: undefined,
|
width: undefined,
|
||||||
|
maxWidth: undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -22,16 +24,19 @@ const emit = defineEmits<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const wrapperStyles = computed(() => {
|
const wrapperStyles = computed(() => {
|
||||||
|
const styles: CSSProperties = {};
|
||||||
if (props.width) {
|
if (props.width) {
|
||||||
const width =
|
styles.width = getWidthStyleValue(props.width);
|
||||||
typeof props.width === "string" ? props.width : `${props.width}px`;
|
|
||||||
return {
|
|
||||||
width,
|
|
||||||
maxWidth: width,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return {};
|
if (props.maxWidth) {
|
||||||
|
styles.maxWidth = getWidthStyleValue(props.maxWidth);
|
||||||
|
}
|
||||||
|
return styles;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getWidthStyleValue(value: string | number) {
|
||||||
|
return typeof value === "string" ? value : `${value}px`;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -138,6 +138,7 @@ function handleDelete() {
|
||||||
name: 'PostEditor',
|
name: 'PostEditor',
|
||||||
query: { name: post.post.metadata.name },
|
query: { name: post.post.metadata.name },
|
||||||
}"
|
}"
|
||||||
|
max-width="30rem"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<VSpace class="mt-1 sm:mt-0">
|
<VSpace class="mt-1 sm:mt-0">
|
||||||
|
|
Loading…
Reference in New Issue