perf: 超链接样式优化

This commit is contained in:
pipipi-pikachu 2021-08-05 21:46:19 +08:00
parent a5faf03588
commit 88c2167d61
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="link-handler"> <div class="link-handler" :style="{ top: elementInfo.height * canvasScale + 10 + 'px' }">
<a class="link" :href="elementInfo.link" target="_blank">{{elementInfo.link}}</a> <a class="link" :href="elementInfo.link" target="_blank">{{elementInfo.link}}</a>
<div class="btns"> <div class="btns">
<div class="btn" @click="openLinkDialog()">更换</div> <div class="btn" @click="openLinkDialog()">更换</div>
@ -10,7 +10,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType } from 'vue' import { computed, defineComponent, PropType } from 'vue'
import { useStore } from '@/store'
import { PPTElement } from '@/types/slides' import { PPTElement } from '@/types/slides'
import useLink from '@/hooks/useLink' import useLink from '@/hooks/useLink'
@ -27,9 +28,13 @@ export default defineComponent({
}, },
}, },
setup() { setup() {
const store = useStore()
const canvasScale = computed(() => store.state.canvasScale)
const { removeLink } = useLink() const { removeLink } = useLink()
return { return {
canvasScale,
removeLink, removeLink,
} }
}, },
@ -40,7 +45,6 @@ export default defineComponent({
.link-handler { .link-handler {
height: 30px; height: 30px;
position: absolute; position: absolute;
top: -36px;
left: 0; left: 0;
font-size: 12px; font-size: 12px;
padding: 0 10px; padding: 0 10px;
@ -51,9 +55,12 @@ export default defineComponent({
color: $themeColor; color: $themeColor;
} }
.link { .link {
max-width: 300px;
margin-right: 20px; margin-right: 20px;
word-break: keep-all; word-break: keep-all;
white-space: nowrap; white-space: nowrap;
@include ellipsis-oneline();
} }
.btns { .btns {
display: flex; display: flex;

View File

@ -9,6 +9,7 @@
fontFamily: theme.fontName, fontFamily: theme.fontName,
visibility: needWaitAnimation ? 'hidden' : 'visible', visibility: needWaitAnimation ? 'hidden' : 'visible',
}" }"
:title="elementInfo.link || ''"
@click="openLink()" @click="openLink()"
> >
<component <component