mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
⚡️ 优化 share 样式
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
:label="switchType === 'avatar' ? '角色' : '武器'"
|
||||
@change="switchType = switchType === 'avatar' ? 'weapon' : 'avatar'"
|
||||
/>
|
||||
<v-btn class="calendar-title-btn" @click="share">
|
||||
<v-btn class="calendar-title-btn" @click="share" data-html2canvas-ignore>
|
||||
<template #prepend>
|
||||
<v-icon>mdi-share-variant</v-icon>
|
||||
</template>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</span>
|
||||
<span v-else> 暂无数据 </span>
|
||||
</div>
|
||||
<div class="uc-top-btns">
|
||||
<div class="uc-top-btns" data-html2canvas-ignore>
|
||||
<v-btn class="uc-top-btn" @click="refreshRoles()">
|
||||
<template #prepend>
|
||||
<v-icon>mdi-refresh</v-icon>
|
||||
@@ -182,7 +182,6 @@ function selectRole(role: TGApp.Sqlite.Character.UserRole): void {
|
||||
<style lang="css" scoped>
|
||||
.uc-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--common-shadow-2);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<span v-if="!isEmpty">{{ getTitle() }} 更新于 {{ recordData.updated }}</span>
|
||||
<span v-else>原神战绩【暂无数据】</span>
|
||||
</div>
|
||||
<div class="ur-top-btns">
|
||||
<div class="ur-top-btns" data-html2canvas-ignore>
|
||||
<v-btn class="ur-top-btn" @click="refresh()">
|
||||
<template #prepend>
|
||||
<v-icon>mdi-refresh</v-icon>
|
||||
@@ -118,7 +118,6 @@ async function shareRecord(): Promise<void> {
|
||||
<style lang="css" scoped>
|
||||
.ur-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
|
||||
@@ -79,18 +79,16 @@ function getShareImgBgColor(): string {
|
||||
* @param {string} fileName - 文件名
|
||||
* @param {HTMLElement} element - 元素
|
||||
* @param {number} scale - 缩放比例
|
||||
* @param {number} offset - 偏移量
|
||||
* @returns {Promise<void>} 无返回值
|
||||
*/
|
||||
export async function generateShareImg(
|
||||
fileName: string,
|
||||
element: HTMLElement,
|
||||
scale: number = 1.2,
|
||||
offset: number = 30,
|
||||
): Promise<void> {
|
||||
const canvas = document.createElement("canvas");
|
||||
const width = element.clientWidth + offset;
|
||||
const height = element.clientHeight + offset;
|
||||
const width = element.clientWidth + 30;
|
||||
const height = element.clientHeight + 30;
|
||||
canvas.width = width * scale;
|
||||
canvas.height = height * scale;
|
||||
const opts = {
|
||||
@@ -101,8 +99,8 @@ export async function generateShareImg(
|
||||
height,
|
||||
useCORS: true,
|
||||
canvas,
|
||||
x: (-offset / 2) * scale,
|
||||
y: (-offset / 2) * scale,
|
||||
x: -10,
|
||||
y: -15,
|
||||
dpi: 350,
|
||||
};
|
||||
const canvasData = await html2canvas(element, opts);
|
||||
|
||||
Reference in New Issue
Block a user