perf: 优化UI

This commit is contained in:
zxc 2024-05-02 15:23:07 +08:00
parent 521c70d5b6
commit 5eb46e3e96
6 changed files with 71 additions and 41 deletions

View File

@ -64,6 +64,7 @@ const handleClick = () => {
line-height: 24px;
padding: 0 7px;
letter-spacing: 0;
font-size: 12px;
}
&.default {

View File

@ -209,7 +209,7 @@ const startResize = (e: MouseEvent) => {
justify-content: center;
align-items: center;
color: #666;
font-size: 12px;
font-size: 13px;
cursor: pointer;
}
.content {

View File

@ -67,7 +67,7 @@
@focus="replyNoteId = ''; activeNoteId = ''"
/>
<div class="footer">
<Button class="btn" v-tooltip="'清空本页批注'" style="flex: 1" @click="clear()"><IconDelete /></Button>
<IconDelete class="btn icon" v-tooltip="'清空本页批注'" style="flex: 1" @click="clear()" />
<Button type="primary" class="btn" style="flex: 12" @click="createNote()">添加批注</Button>
</div>
</div>
@ -314,9 +314,20 @@ const close = () => {
margin-top: 10px;
display: flex;
.btn {
display: flex;
justify-content: center;
align-items: center;
&.icon {
font-size: 18px;
color: #666;
cursor: pointer;
}
}
.btn + .btn {
margin-left: 8px;
flex-shrink: 0;
}
}
}

View File

@ -145,7 +145,7 @@ watch(type, () => {
justify-content: center;
align-items: center;
color: #666;
font-size: 12px;
font-size: 13px;
cursor: pointer;
}
</style>

View File

@ -1,12 +1,18 @@
<template>
<div class="layout-pool">
<div class="header">页面模板</div>
<div class="list">
<div
class="layout-item"
v-for="slide in layouts"
:key="slide.id"
@click="selectSlideTemplate(slide)"
>
<ThumbnailSlide class="thumbnail" :slide="slide" :size="180" />
<div class="btns">
<Button class="btn" type="primary" size="small" @click="insertTemplate(slide)">插入模板</Button>
</div>
</div>
</div>
</div>
</template>
@ -17,44 +23,73 @@ import { useSlidesStore } from '@/store'
import type { Slide } from '@/types/slides'
import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue'
import Button from '@/components/Button.vue'
const emit = defineEmits<{
(event: 'select', payload: Slide): void
}>()
const { layouts } = storeToRefs(useSlidesStore())
const slidesStore = useSlidesStore()
const { layouts } = storeToRefs(slidesStore)
const selectSlideTemplate = (slide: Slide) => {
const insertTemplate = (slide: Slide) => {
emit('select', slide)
}
</script>
<style lang="scss" scoped>
.layout-pool {
width: 394px;
width: 382px;
height: 500px;
}
.header {
height: 40px;
margin: -10px -10px 8px -10px;
padding: 10px 12px 0 12px;
background-color: $lightGray;
border-bottom: 1px solid $borderColor;
}
.list {
height: calc(100% - 40px);
padding: 2px;
margin-right: -12px;
padding-right: 12px;
margin-right: -10px;
padding-right: 10px;
overflow: auto;
@include flex-grid-layout();
}
.layout-item {
position: relative;
@include flex-grid-layout-children(2, 48%);
&:nth-last-child(2), &:last-child {
margin-bottom: 0;
}
&:hover .btns {
opacity: 1;
}
&:hover .thumbnail {
outline-color: $themeColor;
}
.btns {
@include absolute-0();
flex-direction: column;
justify-content: center;
align-items: center;
display: flex;
background-color: rgba($color: #000, $alpha: .25);
opacity: 0;
transition: opacity $transitionDelay;
}
.thumbnail {
outline: 2px solid $borderColor;
transition: outline $transitionDelay;
border-radius: $borderRadius;
cursor: pointer;
&:hover {
outline-color: $themeColor;
}
}
}
</style>

View File

@ -281,8 +281,8 @@
</div>
<div class="btns">
<div class="btn" @click="applyPresetThemeToSingleSlide(item)">应用</div>
<div class="btn" @click="applyPresetThemeToAllSlides(item)">应用全局</div>
<Button type="primary" size="small" @click="applyPresetThemeToSingleSlide(item)">应用</Button>
<Button type="primary" size="small" style="margin-top: 3px;" @click="applyPresetThemeToAllSlides(item)">应用全局</Button>
</div>
</div>
</div>
@ -505,22 +505,5 @@ const updateViewportRatio = (value: number) => {
opacity: 0;
transition: opacity $transitionDelay;
}
.btn {
width: 72px;
padding: 5px 0;
text-align: center;
background-color: $themeColor;
color: #fff;
font-size: 12px;
border-radius: $borderRadius;
&:hover {
background-color: $themeHoverColor;
}
& + .btn {
margin-top: 5px;
}
}
}
</style>