This commit is contained in:
syuilo
2023-05-14 10:50:21 +09:00
parent a979fb9207
commit 238d0fa667
13 changed files with 92 additions and 1043 deletions

View File

@@ -1,44 +1,17 @@
<template>
<div v-if="hpml" class="iroscrza" :class="{ center: page.alignCenter, serif: page.font === 'serif' }">
<XBlock v-for="child in page.content" :key="child.id" :block="child" :hpml="hpml" :h="2"/>
<div class="iroscrza" :class="{ center: page.alignCenter, serif: page.font === 'serif' }">
<XBlock v-for="child in page.content" :key="child.id" :block="child" :h="2"/>
</div>
</template>
<script lang="ts">
import { defineComponent, onMounted, nextTick, PropType } from 'vue';
<script lang="ts" setup>
import { onMounted, nextTick } from 'vue';
import * as Misskey from 'misskey-js';
import XBlock from './page.block.vue';
import { Hpml } from '@/scripts/hpml/evaluator';
import { url } from '@/config';
import { $i } from '@/account';
export default defineComponent({
components: {
XBlock,
},
props: {
page: {
type: Object as PropType<Record<string, any>>,
required: true,
},
},
setup(props, ctx) {
const hpml = new Hpml(props.page, {
randomSeed: Math.random(),
visitor: $i,
url: url,
});
onMounted(() => {
nextTick(() => {
hpml.eval();
});
});
return {
hpml,
};
},
});
defineProps<{
page: Misskey.entities.Page,
}>();
</script>
<style lang="scss" scoped>