Skip to content

Commit

Permalink
🐛 修复 align:right 不生效的问题
Browse files Browse the repository at this point in the history
*PostID:51080404
  • Loading branch information
BTMuli committed Apr 7, 2024
1 parent f50398f commit 98541e1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/components/post/tp-texts.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<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>
</template>
<script lang="ts" setup>
import { onMounted, StyleValue, toRaw } from "vue";
import { StyleValue } from "vue";
import TpText, { type TpText as TpTextType } from "./tp-text.vue";
Expand All @@ -18,10 +18,6 @@ interface TpTextsProps {
const props = defineProps<TpTextsProps>();
if (props.data.attributes) {
console.warn("TpTexts", props.data.attributes);
}
function getLineStyle(): StyleValue {
const style = <Array<StyleValue>>[];
if (props.data.attributes === undefined) {
Expand All @@ -31,8 +27,7 @@ function getLineStyle(): StyleValue {
const headerFontSizes = ["2rem", "1.75rem", "1.5rem", "1.25rem", "1rem", "0.75rem"];
if (props.data.attributes.align) {
const ruleAlign: StyleValue = `textAlign: ${props.data.attributes.align}`;
if (props.data.attributes.align !== "center") style.push("display: inline");
else style.push(ruleAlign);
style.push(ruleAlign);
}
if (props.data.attributes.header) {
const ruleHeader: StyleValue = `fontSize: ${headerFontSizes[props.data.attributes.header - 1]}`;
Expand Down

0 comments on commit 98541e1

Please sign in to comment.