mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🐛 修复 align:right 不生效的问题
*PostID:51080404
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="getLineStyle()" class="tp-texts">
|
<div :style="getLineStyle()" class="tp-texts">
|
||||||
<TpText v-for="(text, indexT) in props.data.children" :data="text" :key="indexT" />
|
<TpText v-for="(text, index) in props.data.children" :data="text" :key="index" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, StyleValue, toRaw } from "vue";
|
import { StyleValue } from "vue";
|
||||||
|
|
||||||
import TpText, { type TpText as TpTextType } from "./tp-text.vue";
|
import TpText, { type TpText as TpTextType } from "./tp-text.vue";
|
||||||
|
|
||||||
@@ -18,10 +18,6 @@ interface TpTextsProps {
|
|||||||
|
|
||||||
const props = defineProps<TpTextsProps>();
|
const props = defineProps<TpTextsProps>();
|
||||||
|
|
||||||
if (props.data.attributes) {
|
|
||||||
console.warn("TpTexts", props.data.attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLineStyle(): StyleValue {
|
function getLineStyle(): StyleValue {
|
||||||
const style = <Array<StyleValue>>[];
|
const style = <Array<StyleValue>>[];
|
||||||
if (props.data.attributes === undefined) {
|
if (props.data.attributes === undefined) {
|
||||||
@@ -31,8 +27,7 @@ function getLineStyle(): StyleValue {
|
|||||||
const headerFontSizes = ["2rem", "1.75rem", "1.5rem", "1.25rem", "1rem", "0.75rem"];
|
const headerFontSizes = ["2rem", "1.75rem", "1.5rem", "1.25rem", "1rem", "0.75rem"];
|
||||||
if (props.data.attributes.align) {
|
if (props.data.attributes.align) {
|
||||||
const ruleAlign: StyleValue = `textAlign: ${props.data.attributes.align}`;
|
const ruleAlign: StyleValue = `textAlign: ${props.data.attributes.align}`;
|
||||||
if (props.data.attributes.align !== "center") style.push("display: inline");
|
style.push(ruleAlign);
|
||||||
else style.push(ruleAlign);
|
|
||||||
}
|
}
|
||||||
if (props.data.attributes.header) {
|
if (props.data.attributes.header) {
|
||||||
const ruleHeader: StyleValue = `fontSize: ${headerFontSizes[props.data.attributes.header - 1]}`;
|
const ruleHeader: StyleValue = `fontSize: ${headerFontSizes[props.data.attributes.header - 1]}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user