perf: add tooltip for some icon buttons (#745)

#### What type of PR is this?
/kind improvement

#### What this PR does / why we need it:
部分 UI 元素使用了图标代替文字,但某些情况下可能会导致无法直观的判断具体用途,添加 tooltip 以提示使用者。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2656

#### Screenshots:
![image](https://user-images.githubusercontent.com/28836989/205815182-4e599e7b-58b9-4b38-8a8f-11685c4f5f4d.png)
![image](https://user-images.githubusercontent.com/28836989/205815258-90bc111d-552c-456b-a9ce-d2a4e7a4f93d.png)

#### Does this PR introduce a user-facing change?

```release-note
Console 端为部分图标按钮添加操作提示,提升可访问性。
```
pull/762/head^2
ZXSheng 2022-12-09 15:16:15 +08:00 committed by GitHub
parent 8119e5a484
commit faba6f40ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 6 deletions

View File

@ -228,10 +228,12 @@ const getPolicyName = (name: string | undefined) => {
const viewTypes = [
{
name: "list",
tooltip: "列表模式",
icon: IconList,
},
{
name: "grid",
tooltip: "网格模式",
icon: IconGrid,
},
];
@ -526,6 +528,7 @@ onMounted(() => {
<div
v-for="(item, index) in viewTypes"
:key="index"
v-tooltip="`${item.tooltip}`"
:class="{
'bg-gray-200 font-bold text-black':
viewType === item.name,
@ -542,6 +545,7 @@ onMounted(() => {
@click="handleFetchAttachments()"
>
<IconRefreshLine
v-tooltip="`刷新`"
:class="{ 'animate-spin text-gray-900': loading }"
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
/>

View File

@ -457,6 +457,7 @@ function handleClearFilters() {
@click="handleFetchComments()"
>
<IconRefreshLine
v-tooltip="`刷新`"
:class="{ 'animate-spin text-gray-900': loading }"
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
/>

View File

@ -427,10 +427,10 @@ function handleClearFilters() {
>
<template #actions>
<span @click="handleSelectPrevious">
<IconArrowLeft />
<IconArrowLeft v-tooltip="``" />
</span>
<span @click="handleSelectNext">
<IconArrowRight />
<IconArrowRight v-tooltip="``" />
</span>
</template>
</SinglePageSettingModal>
@ -611,6 +611,7 @@ function handleClearFilters() {
@click="handleFetchSinglePages()"
>
<IconRefreshLine
v-tooltip="`刷新`"
:class="{ 'animate-spin text-gray-900': loading }"
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
/>

View File

@ -455,10 +455,10 @@ const hasFilters = computed(() => {
>
<template #actions>
<span @click="handleSelectPrevious">
<IconArrowLeft />
<IconArrowLeft v-tooltip="``" />
</span>
<span @click="handleSelectNext">
<IconArrowRight />
<IconArrowRight v-tooltip="``" />
</span>
</template>
</PostSettingModal>
@ -705,6 +705,7 @@ const hasFilters = computed(() => {
@click="handleFetchPosts()"
>
<IconRefreshLine
v-tooltip="`刷新`"
:class="{ 'animate-spin text-gray-900': loading }"
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
/>

View File

@ -305,6 +305,7 @@ function handleClearFilters() {
@click="handleFetchPlugins()"
>
<IconRefreshLine
v-tooltip="`刷新`"
:class="{ 'animate-spin text-gray-900': loading }"
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
/>

View File

@ -149,8 +149,8 @@ const handleRawModeChange = () => {
>
<template #actions>
<span @click="handleRawModeChange">
<IconCodeBoxLine v-if="!rawMode" />
<IconEye v-else />
<IconCodeBoxLine v-if="!rawMode" v-tooltip="``" />
<IconEye v-else v-tooltip="``" />
</span>
</template>