mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-08 20:39:25 +08:00
57 lines
1.3 KiB
Vue
57 lines
1.3 KiB
Vue
<template>
|
|
<Colomn @close="exit" :width="80" :height="80" :left="30" :right="70"
|
|
><template #left
|
|
><div id="desc-list">
|
|
<div
|
|
v-for="(data, k) in desc"
|
|
class="selectable"
|
|
:selected="selected === k"
|
|
@click="click(k)"
|
|
>
|
|
<span v-if="show(data.condition)">{{ data.text }}</span>
|
|
</div>
|
|
</div></template
|
|
>
|
|
<template #right><span v-html="content"></span></template
|
|
></Colomn>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, ref } from 'vue';
|
|
import desc from '../data/desc.json';
|
|
import { has, splitText } from '../plugin/utils';
|
|
import Colomn from '../components/colomn.vue';
|
|
|
|
type DescKey = keyof typeof desc;
|
|
|
|
const selected = ref(Object.keys(desc)[0] as DescKey);
|
|
|
|
function exit() {
|
|
core.plugin.descOpened.value = false;
|
|
}
|
|
|
|
const content = computed(() => {
|
|
return splitText(desc[selected.value].desc);
|
|
});
|
|
|
|
function click(key: DescKey) {
|
|
if (!eval(desc[key].condition)) return;
|
|
selected.value = key;
|
|
}
|
|
|
|
function show(condition: string) {
|
|
return eval(condition);
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
#desc-left {
|
|
flex-basis: 30%;
|
|
}
|
|
|
|
#desc-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
</style>
|